Documentation ¶
Index ¶
- func ContextWithDb(ctx context.Context, db *pg.DB) context.Context
- func ContextWithTx(ctx context.Context, tx *pg.Tx) context.Context
- func ContextWithValue(ctx context.Context, keyName string, value interface{}) context.Context
- func DbFromContext(ctx context.Context) *pg.DB
- func Execute(ctx context.Context, execFunc ExecFunc) error
- func ExecuteWithPropagation(ctx context.Context, propagation Propagation, execFunc ExecFunc) error
- func TxFromContext(ctx context.Context) *pg.Tx
- func ValueFromContext(ctx context.Context, keyName string) interface{}
- type ExecFunc
- type Propagation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithDb ¶
ContextWithDb sets Db to context request
func ContextWithTx ¶
ContextWithTx sets Tx to context request
func ContextWithValue ¶
ContextWithValue sets Value to context request
func DbFromContext ¶
DbFromContext retrives Db from context
func ExecuteWithPropagation ¶
func ExecuteWithPropagation(ctx context.Context, propagation Propagation, execFunc ExecFunc) error
ExecuteWithPropagation executes ExecFunc in transaction with specific propagation
func TxFromContext ¶
TxFromContext retrives Tx from context
func ValueFromContext ¶
ValueFromContext retrives Value from context
Types ¶
type Propagation ¶
type Propagation string
Propagation type
const ( // Current supports a current transaction, creates a new one if none exists. Current Propagation = "Current" // Mandatory needs a current transaction, return an exception if none exists Mandatory Propagation = "Mandatory" // Savepoint supports a current transaction, creates a new one if none exists, creates savepoint and never return propagation error Savepoint Propagation = "Savepoint" )
Click to show internal directories.
Click to hide internal directories.