Documentation ¶
Overview ¶
Example ¶
var pool *pgxpool.Pool db, err := pgxutil.New(pool) if err != nil { panic(err) } ctx := context.Background() // to make transaction with a given isolation level level := pgx.Serializable errTx := db.InWriteTx(ctx, level, func(tx pgx.Tx) error { // TODO: good query with tx return nil }) if errTx != nil { panic(errTx) } // to make read-only transaction with a read committed isolation level errRead := db.InReadTx(ctx, func(tx pgx.Tx) error { // TODO: good read-only query with tx return nil }) if errRead != nil { panic(errRead) }
Output:
Index ¶
- func Exec(ctx context.Context, db *DB, b builq.Builder) error
- func ExecRead[T Scannable](ctx context.Context, db *DB, b builq.Builder, dst T) error
- func Read[T Scannable](ctx context.Context, db *DB, b builq.Builder, dst T) error
- func ReadMany[T Scannable](ctx context.Context, db *DB, b builq.Builder, dst *[]T) error
- type DB
- type Int64
- type Scannable
- type String
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.