Documentation ¶
Index ¶
- type DB
- func (db *DB) Close() (err error)
- func (db *DB) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (db *DB) Get(ctx context.Context, dest any, query string, args ...any) error
- func (db *DB) Query(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (db *DB) Select(ctx context.Context, dest any, query string, args ...any) error
- func (db *DB) Transaction(ctx context.Context, fn func(tx *Tx) error) (err error)
- type DBOptions
- type Queryer
- type Tx
- func (tx *Tx) Commit() error
- func (tx *Tx) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (tx *Tx) Get(ctx context.Context, dest any, query string, args ...any) error
- func (tx *Tx) Query(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (tx *Tx) Rollback() error
- func (tx *Tx) Select(ctx context.Context, dest any, query string, args ...any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) Exec ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*DB) Get ¶
Get a single record. Any placeholder parameters are replaced with supplied args. An `ErrNoRows` error is returned if the result set is empty.
func (*DB) Query ¶
Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.
type Queryer ¶
type Queryer interface { Get(ctx context.Context, dest any, query string, args ...any) error Select(ctx context.Context, dest any, query string, args ...any) error Query(ctx context.Context, query string, args ...any) (*sql.Rows, error) Exec(ctx context.Context, query string, args ...any) (sql.Result, error) }
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Transaction is wrapper of `sqlx.Tx` which implements `Tx`
func (*Tx) Exec ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*Tx) Get ¶
Get a single record. Any placeholder parameters are replaced with supplied args. An `ErrNoRows` error is returned if the result set is empty.