Documentation
¶
Overview ¶
Package stdent provides re-usable code for interacting with the Ent orm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HookDriver ¶
type HookDriver struct { entdialect.Driver // contains filtered or unexported fields }
HookDriver is an Ent driver that wraps a base driver to allow a hook to be configured for every transaction that is started. Useful for sql settings scoped to the transaction such as the current_user_id, or the role.
func NewTxHookDriver ¶
func NewTxHookDriver(base entdialect.Driver, hook TxHookFunc) *HookDriver
func (HookDriver) BeginTx ¶
func (d HookDriver) BeginTx(ctx context.Context, opts *sql.TxOptions) (entdialect.Tx, error)
BeginTx calls the base driver's method if it's supported and calls our hook.
func (HookDriver) Tx ¶
func (d HookDriver) Tx(ctx context.Context) (entdialect.Tx, error)
Tx calls the base driver's method with the same symbol and invokes our hook.
type TxHookFunc ¶
type TxHookFunc func(ctx context.Context, tx entdialect.Tx) error
Click to show internal directories.
Click to hide internal directories.