Documentation ¶
Index ¶
- Variables
- func ContextExecutor(ctx context.Context, dbs ...*gorm.DB) *gorm.DB
- func ContextTransaction(ctx context.Context, dbs ...*gorm.DB) (*gorm.DB, context.Context, bool, error)
- func ContextTransactionExec(ctx context.Context, fn func(ctx context.Context, tx *gorm.DB) error, ...) error
- func Master(ctx context.Context) *gorm.DB
- func Readonly(ctx context.Context) *gorm.DB
- func WithDatabase(ctx context.Context, master, slave *gorm.DB) context.Context
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CtxDatabase = struct{ s string }{"db"} CtxTransaction = struct{ s string }{"db:transaction"} )
List of context keys
Functions ¶
func ContextExecutor ¶
ContextExecutor returns SQL executor from opened transaction or master connection
func ContextTransaction ¶
func ContextTransaction(ctx context.Context, dbs ...*gorm.DB) (*gorm.DB, context.Context, bool, error)
ContextTransaction get or init new transaction and put object to the context
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.