repo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogRepoReturn

func LogRepoReturn(logger log.Logger)

func RepoFunctionContext added in v0.2.0

func RepoFunctionContext(ctx context.Context, repoFunction string) (repoContext context.Context, logger log.Logger)

Types

type DAO

type DAO interface {
	Context() context.Context
	Logger() log.Logger

	Exec(query string, args ...interface{}) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	Get(dest interface{}, query string, args ...interface{}) error
	GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	NamedExec(query string, arg interface{}) (sql.Result, error)
	NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
	NamedQuery(query string, arg interface{}) (*sqlx.Rows, error)
	PrepareNamed(query string) (*sqlx.NamedStmt, error)
	PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)
	Preparex(query string) (*sqlx.Stmt, error)
	PreparexContext(ctx context.Context, query string) (*sqlx.Stmt, error)
	Rebind(query string) string
	Select(dest interface{}, query string, args ...interface{}) error
	SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	Unsafe() DAO
}

type DBDAO

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

func NewDBDAO

func NewDBDAO(db *sqlx.DB, ctx context.Context) *DBDAO

func (*DBDAO) Context added in v0.2.0

func (dao *DBDAO) Context() context.Context

func (*DBDAO) Exec

func (dao *DBDAO) Exec(query string, args ...interface{}) (sql.Result, error)

func (*DBDAO) ExecContext

func (dao *DBDAO) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*DBDAO) Get

func (dao *DBDAO) Get(dest interface{}, query string, args ...interface{}) error

func (*DBDAO) GetContext

func (dao *DBDAO) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*DBDAO) Logger

func (dao *DBDAO) Logger() log.Logger

func (*DBDAO) NamedExec

func (dao *DBDAO) NamedExec(query string, arg interface{}) (sql.Result, error)

func (*DBDAO) NamedExecContext

func (dao *DBDAO) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)

func (*DBDAO) NamedQuery

func (dao *DBDAO) NamedQuery(query string, arg interface{}) (*sqlx.Rows, error)

func (*DBDAO) PrepareNamed

func (dao *DBDAO) PrepareNamed(query string) (*sqlx.NamedStmt, error)

func (*DBDAO) PrepareNamedContext

func (dao *DBDAO) PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)

func (*DBDAO) Preparex

func (dao *DBDAO) Preparex(query string) (*sqlx.Stmt, error)

func (*DBDAO) PreparexContext

func (dao *DBDAO) PreparexContext(ctx context.Context, query string) (*sqlx.Stmt, error)

func (*DBDAO) Rebind

func (dao *DBDAO) Rebind(query string) string

func (*DBDAO) Select

func (dao *DBDAO) Select(dest interface{}, query string, args ...interface{}) error

func (*DBDAO) SelectContext

func (dao *DBDAO) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*DBDAO) Unsafe

func (dao *DBDAO) Unsafe() DAO

type Repo

type Repo struct {
	DB *sqlx.DB
}

func (*Repo) NonTx

func (repo *Repo) NonTx(ctx context.Context) *DBDAO

func (*Repo) SerializableTx

func (repo *Repo) SerializableTx(ctx context.Context, transactionFunc func(*TxDAO) error) error

type TxDAO

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

func NewTXDAO

func NewTXDAO(db *sqlx.DB, ctx context.Context) (*TxDAO, error)

func (*TxDAO) Context added in v0.2.0

func (dao *TxDAO) Context() context.Context

func (*TxDAO) Exec

func (dao *TxDAO) Exec(query string, args ...interface{}) (sql.Result, error)

func (*TxDAO) ExecContext

func (dao *TxDAO) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*TxDAO) Get

func (dao *TxDAO) Get(dest interface{}, query string, args ...interface{}) error

func (*TxDAO) GetContext

func (dao *TxDAO) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*TxDAO) Logger

func (dao *TxDAO) Logger() log.Logger

func (*TxDAO) NamedExec

func (dao *TxDAO) NamedExec(query string, arg interface{}) (sql.Result, error)

func (*TxDAO) NamedExecContext

func (dao *TxDAO) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)

func (*TxDAO) NamedQuery

func (dao *TxDAO) NamedQuery(query string, arg interface{}) (*sqlx.Rows, error)

func (*TxDAO) PrepareNamed

func (dao *TxDAO) PrepareNamed(query string) (*sqlx.NamedStmt, error)

func (*TxDAO) PrepareNamedContext

func (dao *TxDAO) PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)

func (*TxDAO) Preparex

func (dao *TxDAO) Preparex(query string) (*sqlx.Stmt, error)

func (*TxDAO) PreparexContext

func (dao *TxDAO) PreparexContext(ctx context.Context, query string) (*sqlx.Stmt, error)

func (*TxDAO) Rebind

func (dao *TxDAO) Rebind(query string) string

func (*TxDAO) Select

func (dao *TxDAO) Select(dest interface{}, query string, args ...interface{}) error

func (*TxDAO) SelectContext

func (dao *TxDAO) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*TxDAO) Unsafe

func (dao *TxDAO) Unsafe() DAO

Jump to

Keyboard shortcuts

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