Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDatabaseTypeInvalid throws when QueryExecutor not *sql.DB // are you try to run transaction in transaction? ErrDatabaseTypeInvalid = errors.New("wrong database struct type") )
Functions ¶
This section is empty.
Types ¶
type QueryExecutor ¶
type QueryExecutor interface { ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) }
QueryExecutor is execution interface of sql.Tx and sql.DB
type Tx ¶
type Tx interface { DoTransaction(construct func(tx QueryExecutor) Tx, action func(txRepo Tx) error) (err error) DB() (db QueryExecutor) }
Tx repo tx helper
func NewTx ¶
func NewTx(db QueryExecutor) Tx
Click to show internal directories.
Click to hide internal directories.