dao

package
v0.0.0-...-bae9ab4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NilStr

func NilStr(s string) sql.NullString

Types

type DAO

type DAO struct {
	*Queries
	// contains filtered or unexported fields
}

func NewDAO

func NewDAO(ctx context.Context, logz *logz.Log, c *conf.Config) (*DAO, func(), error)

func (*DAO) BeginTx

func (q *DAO) BeginTx(ctx context.Context) (DBInterface, func(), error)

func (*DAO) Commit

func (q *DAO) Commit(ctx context.Context) error

func (*DAO) DB

func (q *DAO) DB() *sql.DB

func (*DAO) Ping

func (q *DAO) Ping(ctx context.Context) error

type DBInterface

type DBInterface interface {
	Querier
	DB() *sql.DB
	Ping(ctx context.Context) error
	BeginTx(ctx context.Context) (DBInterface, func(), error)
	Commit(ctx context.Context) error
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Expense

type Expense struct {
	ID          string
	WalletID    string
	Amount      float64
	Description sql.NullString
	CreatedAt   time.Time
}

func (*Expense) GetAmount

func (e *Expense) GetAmount() float64

func (*Expense) GetCreatedAt

func (e *Expense) GetCreatedAt() time.Time

func (*Expense) GetDescription

func (e *Expense) GetDescription() *string

func (*Expense) GetID

func (e *Expense) GetID() string

func (*Expense) GetWalletID

func (e *Expense) GetWalletID() string

func (*Expense) IsOperation

func (e *Expense) IsOperation()

type ExpenseInsertParams

type ExpenseInsertParams struct {
	ID          string
	WalletID    string
	Amount      float64
	Description sql.NullString
	CreatedAt   time.Time
}

type History

type History struct {
	ID        string
	Namespace string
	Reference string
	Event     string
	Email     string
	CreatedAt time.Time
}

type HistoryInsertParams

type HistoryInsertParams struct {
	ID        string
	Namespace string
	Reference string
	Event     string
	Email     string
	CreatedAt time.Time
}

type LocalUser

type LocalUser struct {
	ID          string
	Email       string
	DisplayName string
	Roles       string
	Pwdhash     string
	CreatedAt   time.Time
}

type LocalUserInsertParams

type LocalUserInsertParams struct {
	ID          string
	Email       string
	DisplayName string
	Roles       string
	CreatedAt   time.Time
	Pwdhash     string
}

type Querier

type Querier interface {
	ExpenseInsert(ctx context.Context, arg *ExpenseInsertParams) error
	ExpenseListByWallet(ctx context.Context, walletID string) ([]*Expense, error)
	ExpenseListByWalletByUser(ctx context.Context, walletID string, userID string) ([]*Expense, error)
	HistoryInsert(ctx context.Context, arg *HistoryInsertParams) error
	HistoryList(ctx context.Context) ([]*History, error)
	LocalUserGetByEmail(ctx context.Context, email string) (*LocalUser, error)
	LocalUserGetByID(ctx context.Context, id string) (*LocalUser, error)
	LocalUserInsert(ctx context.Context, arg *LocalUserInsertParams) error
	LocalUserList(ctx context.Context) ([]*LocalUser, error)
	LocalUserSetPass(ctx context.Context, pwdhash string, email string) error
	LocalUserUpdate(ctx context.Context, roles string, email string) error
	WalletInsert(ctx context.Context, arg *WalletInsertParams) error
	WalletUpdateBalance(ctx context.Context, balance float64, iD string) error
	WalletsByAdmin(ctx context.Context) ([]*Wallet, error)
	WalletsByUser(ctx context.Context, userID string) ([]*Wallet, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) ExpenseInsert

func (q *Queries) ExpenseInsert(ctx context.Context, arg *ExpenseInsertParams) error

func (*Queries) ExpenseListByWallet

func (q *Queries) ExpenseListByWallet(ctx context.Context, walletID string) ([]*Expense, error)

func (*Queries) ExpenseListByWalletByUser

func (q *Queries) ExpenseListByWalletByUser(ctx context.Context, walletID string, userID string) ([]*Expense, error)

func (*Queries) HistoryInsert

func (q *Queries) HistoryInsert(ctx context.Context, arg *HistoryInsertParams) error

func (*Queries) HistoryList

func (q *Queries) HistoryList(ctx context.Context) ([]*History, error)

func (*Queries) LocalUserGetByEmail

func (q *Queries) LocalUserGetByEmail(ctx context.Context, email string) (*LocalUser, error)

func (*Queries) LocalUserGetByID

func (q *Queries) LocalUserGetByID(ctx context.Context, id string) (*LocalUser, error)

func (*Queries) LocalUserInsert

func (q *Queries) LocalUserInsert(ctx context.Context, arg *LocalUserInsertParams) error

func (*Queries) LocalUserList

func (q *Queries) LocalUserList(ctx context.Context) ([]*LocalUser, error)

func (*Queries) LocalUserSetPass

func (q *Queries) LocalUserSetPass(ctx context.Context, pwdhash string, email string) error

func (*Queries) LocalUserUpdate

func (q *Queries) LocalUserUpdate(ctx context.Context, roles string, email string) error

func (*Queries) WalletInsert

func (q *Queries) WalletInsert(ctx context.Context, arg *WalletInsertParams) error

func (*Queries) WalletUpdateBalance

func (q *Queries) WalletUpdateBalance(ctx context.Context, balance float64, iD string) error

func (*Queries) WalletsByAdmin

func (q *Queries) WalletsByAdmin(ctx context.Context) ([]*Wallet, error)

func (*Queries) WalletsByUser

func (q *Queries) WalletsByUser(ctx context.Context, userID string) ([]*Wallet, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Wallet

type Wallet struct {
	ID        string
	UserID    string
	Balance   float64
	Currency  string
	CreatedAt time.Time
}

type WalletInsertParams

type WalletInsertParams struct {
	ID        string
	UserID    string
	Balance   float64
	Currency  string
	CreatedAt time.Time
}

Jump to

Keyboard shortcuts

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