Documentation
¶
Index ¶
- func Do(ctx context.Context, trm Trm, level pgx.TxIsoLevel, ...) error
- func DoAndRet[T any](ctx context.Context, mgr Trm, level pgx.TxIsoLevel, ...) (ret T, err error)
- func DoReadCommitted(ctx context.Context, manager Trm, fn func(ctx context.Context) error, ...) error
- func DoReadCommittedRet[T any](ctx context.Context, manager Trm, f func(ctx context.Context) (T, error), ...) (ret T, err error)
- func DoReadUncommitted(ctx context.Context, manager Trm, fn func(ctx context.Context) error, ...) error
- func DoReadUncommittedRet[T any](ctx context.Context, manager Trm, f func(ctx context.Context) (T, error), ...) (ret T, err error)
- func DoRepeatableRead(ctx context.Context, manager Trm, fn func(ctx context.Context) error, ...) error
- func DoRepeatableReadRet[T any](ctx context.Context, manager Trm, f func(ctx context.Context) (T, error), ...) (ret T, err error)
- func DoSerializable(ctx context.Context, manager Trm, fn func(ctx context.Context) error, ...) error
- func DoSerializableRet[T any](ctx context.Context, manager Trm, f func(ctx context.Context) (T, error), ...) (ret T, err error)
- func DoSettings(ctx context.Context, trm Trm, settings *trmpgx.Settings, ...) error
- func NewSettings(level pgx.TxIsoLevel, opts ...settings.Opt) *trmpgx.Settings
- func ReadCommitted(opts ...settings.Opt) *trmpgx.Settings
- func ReadUncommitted(opts ...settings.Opt) *trmpgx.Settings
- func RepeatableRead(opts ...settings.Opt) *trmpgx.Settings
- func Serializable(opts ...settings.Opt) *trmpgx.Settings
- type DB
- type DbOption
- type Trm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoReadCommitted ¶
func DoReadCommittedRet ¶
func DoReadUncommitted ¶
func DoReadUncommittedRet ¶
func DoRepeatableRead ¶
func DoRepeatableReadRet ¶
func DoSerializable ¶
func DoSerializableRet ¶
func DoSettings ¶
func NewSettings ¶
Types ¶
type DB ¶
type DB interface {
// Exec executes the given SQL statement with the provided arguments in the context of the executor.
//
// Parameters:
// - ctx: The context.Context object.
// - sql: The SQL statement to execute.
// - arguments: The arguments to be passed to the SQL statement.
//
// Returns:
// - pgconn.CommandTag: The command tag returned by the execution.
// - error: An error if the execution fails.
Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
// Query executes a SQL query with the provided arguments in the context of the executor.
//
// Parameters:
// - ctx: The context.Context object.
// - sql: The SQL query to execute.
// - arguments: The arguments to be passed to the SQL query.
//
// Returns:
// - pgx.Rows: The result of the query.
// - error: An error if the query execution fails.
Query(ctx context.Context, sql string, arguments ...interface{}) (pgx.Rows, error)
// QueryRow executes a SQL query with the provided arguments in the context of the executor,
// returning a single row result.
//
// Parameters:
// - ctx: The context.Context object.
// - sql: The SQL query to execute.
// - arguments: The arguments to be passed to the SQL query.
//
// Returns:
// - pgx.Row: The result of the query as a single row.
QueryRow(ctx context.Context, sql string, arguments ...interface{}) pgx.Row
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
}
type DbOption ¶
type DbOption func(*executor)
func WithCtxGetter ¶
func WithCtxGetter(ctxGetter ctxGetter) DbOption
WithCtxGetter sets the ctxGetter for the TxExecutor.
Parameters: - ctxGetter: The ctxGetter implementation to be used.
Returns: - TxExecutorOption: A function that takes a TxExecutor pointer and sets its ctxGetter field.
Click to show internal directories.
Click to hide internal directories.