Documentation
¶
Index ¶
- func WithAccessMode(mode pgx.TxAccessMode) transaction_manager.TransactionOption
- func WithDeferrableMode(mode pgx.TxDeferrableMode) transaction_manager.TransactionOption
- func WithIsoLevel(lvl pgx.TxIsoLevel) transaction_manager.TransactionOption
- type PgxCommonAPI
- type PgxExtendedAPI
- type QueryEngine
- type QueryEngineProvider
- type TransactionManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAccessMode ¶
func WithAccessMode(mode pgx.TxAccessMode) transaction_manager.TransactionOption
WithAccessMode - set transaction AccessMode
func WithDeferrableMode ¶
func WithDeferrableMode(mode pgx.TxDeferrableMode) transaction_manager.TransactionOption
WithDeferrableMode - set transaction DeferrableMode
func WithIsoLevel ¶
func WithIsoLevel(lvl pgx.TxIsoLevel) transaction_manager.TransactionOption
WithIsoLevel - set transaction IsoLevel
Types ¶
type PgxCommonAPI ¶
type PgxCommonAPI interface {
QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
}
PgxCommonAPI - pgx common API (like database/sql)
type PgxExtendedAPI ¶
type PgxExtendedAPI interface {
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}
PgxExtendedAPI - pgx special API
type QueryEngine ¶
type QueryEngine interface {
PgxCommonAPI
PgxExtendedAPI
}
QueryEngine is a common database query interface.
type QueryEngineProvider ¶
type QueryEngineProvider interface {
// returns pgx QueryEngine API
GetQueryEngine(ctx context.Context) QueryEngine
}
QueryEngineProvider - something that gives us QueryEngine
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
TransactionManager - transaction manager: allows you to perform the functions of different repositories included in one database within a transaction.
func New ¶
func New(pool *pgxpool.Pool) *TransactionManager
New returns transaction_manager.TransactionManager interface implementation
func (*TransactionManager) GetQueryEngine ¶
func (m *TransactionManager) GetQueryEngine(ctx context.Context) QueryEngine
GetQueryEngine provides QueryEngine
func (*TransactionManager) RunTransaction ¶
func (m *TransactionManager) RunTransaction( ctx context.Context, fn func(txCtx context.Context) error, opts ...transaction_manager.TransactionOption, ) error
RunReadCommitted - execute function fn in runTransaction
Click to show internal directories.
Click to hide internal directories.