wallets

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

templ: version: v0.2.513

templ: version: v0.2.513

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

func (*Repository) AddMember

func (w *Repository) AddMember(ctx context.Context, walletId, userId int) error

func (*Repository) Create

func (w *Repository) Create(ctx context.Context, userId int, name string) (*models.Wallet, error)

func (*Repository) Delete

func (w *Repository) Delete(ctx context.Context, walletId int) error

func (*Repository) ForId

func (w *Repository) ForId(ctx context.Context, walletId int) (*models.Wallet, error)

func (*Repository) ForUser

func (w *Repository) ForUser(ctx context.Context, userId int) ([]*models.Wallet, error)

func (*Repository) HasPermission

func (w *Repository) HasPermission(ctx context.Context, walletId, userId int) (bool, error)

func (*Repository) Members

func (w *Repository) Members(ctx context.Context, walletId int) ([]*models.Member, error)

func (*Repository) RemoveMember

func (w *Repository) RemoveMember(ctx context.Context, walletId int, userId string) error

func (*Repository) SetName

func (w *Repository) SetName(ctx context.Context, walletId int, name string) error

type RepositoryInterface

type RepositoryInterface interface {
	ForUser(ctx context.Context, userId int) ([]*models.Wallet, error)
	Create(ctx context.Context, userId int, name string) (*models.Wallet, error)
	HasPermission(ctx context.Context, walletId, userId int) (bool, error)
	ForId(ctx context.Context, walletId int) (*models.Wallet, error)
	Members(ctx context.Context, walletId int) ([]*models.Member, error)
	SetName(ctx context.Context, walletId int, name string) error
	AddMember(ctx context.Context, walletId, userId int) error
	RemoveMember(ctx context.Context, walletId int, userId string) error
	Delete(ctx context.Context, walletId int) error
}

type UserRepository

type UserRepository interface {
	GetByUsername(ctx context.Context, username string) (*models.UserCredentials, error)
}

type Wallets

type Wallets struct {
	// contains filtered or unexported fields
}

func New

func New(
	repository RepositoryInterface,
	userRepository UserRepository,
	log *slog.Logger,
) *Wallets

func (*Wallets) Mount

func (wlts *Wallets) Mount(router chi.Router)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL