Documentation ¶
Index ¶
- Constants
- Variables
- func GetTransactionFromContextOrCreate(ctx context.Context, db *pg.DB) (*pg.Tx, error)
- func NewDB(globalLogger hclog.Logger, startupConf conf.Startup) (*pg.DB, error)
- func NewTxPerRequestMiddleware(parentLogger hclog.Logger, txBuilder TransactionBuilder) func(next http.Handler) http.Handler
- type LazyTransaction
- type TransactionBuilder
Constants ¶
View Source
const TransactionPerRequestKey ctxKeyTransaction = 0
RequestIDKey is the key that holds th unique request ID in a request context.
Variables ¶
View Source
var Providers = wire.NewSet(NewDB, NewPostgreTransactionBuilder)
Providers are the wire providers for store
Functions ¶
func NewTxPerRequestMiddleware ¶
func NewTxPerRequestMiddleware( parentLogger hclog.Logger, txBuilder TransactionBuilder, ) func(next http.Handler) http.Handler
Types ¶
type LazyTransaction ¶
type LazyTransaction interface { HasTransaction() bool GetCurrent() (*pg.Tx, error) CommitIfNeeded() error RollbackIfNeeded() error }
func GetTransactionFromContext ¶
func GetTransactionFromContext(ctx context.Context) LazyTransaction
func NewLazyTransaction ¶
func NewLazyTransaction(db *pg.DB) LazyTransaction
type TransactionBuilder ¶
type TransactionBuilder interface {
BuildLazyTransactionContext(ctx context.Context) (context.Context, LazyTransaction, error)
}
TransactionBuilder builds database transactions
func NewPostgreTransactionBuilder ¶
func NewPostgreTransactionBuilder(db *pg.DB) TransactionBuilder
NewPostgreTransactionBuilder creates the builder implementation for PostgreSQL
Source Files ¶
Click to show internal directories.
Click to hide internal directories.