Documentation ¶
Index ¶
- func ConnFromContext(ctx context.Context) interface{ ... }
- func New(d driver.Driver, hook Hook) driver.Driver
- func PrepareContextFromContext(ctx context.Context) context.Context
- func StmtFromContext(ctx context.Context) interface{ ... }
- type ConnHook
- type ConnectorHook
- type Hook
- type StmtHook
- type TxHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnFromContext ¶ added in v0.3.0
func ConnFromContext(ctx context.Context) interface { driver.Conn driver.ConnPrepareContext driver.ConnBeginTx }
func StmtFromContext ¶ added in v0.3.0
func StmtFromContext(ctx context.Context) interface { driver.Stmt driver.StmtExecContext driver.StmtQueryContext }
Types ¶
type ConnHook ¶
type ConnHook interface { BeforeExecContext(ctx context.Context, query string, args []driver.NamedValue, err error) (context.Context, string, []driver.NamedValue, error) AfterExecContext(ctx context.Context, query string, args []driver.NamedValue, dr driver.Result, err error) (context.Context, driver.Result, error) BeforeBeginTx(ctx context.Context, opts driver.TxOptions, err error) (context.Context, driver.TxOptions, error) AfterBeginTx(ctx context.Context, opts driver.TxOptions, dt driver.Tx, err error) (context.Context, driver.Tx, error) BeforeQueryContext(ctx context.Context, query string, args []driver.NamedValue, err error) (context.Context, string, []driver.NamedValue, error) AfterQueryContext(ctx context.Context, query string, args []driver.NamedValue, rows driver.Rows, err error) (context.Context, driver.Rows, error) BeforePrepareContext(ctx context.Context, query string, err error) (context.Context, string, error) AfterPrepareContext(ctx context.Context, query string, ds driver.Stmt, err error) (context.Context, driver.Stmt, error) BeforeClose(ctx context.Context, err error) (context.Context, error) AfterClose(ctx context.Context, err error) (context.Context, error) }
type ConnectorHook ¶
type StmtHook ¶
type StmtHook interface { BeforeStmtQueryContext(ctx context.Context, query string, args []driver.NamedValue, err error) (context.Context, []driver.NamedValue, error) AfterStmtQueryContext(ctx context.Context, query string, args []driver.NamedValue, rows driver.Rows, err error) (context.Context, driver.Rows, error) BeforeStmtExecContext(ctx context.Context, query string, args []driver.NamedValue, err error) (context.Context, []driver.NamedValue, error) AfterStmtExecContext(ctx context.Context, query string, args []driver.NamedValue, r driver.Result, err error) (context.Context, driver.Result, error) }
type TxHook ¶
type TxHook interface { BeforeCommit(ctx context.Context, err error) (context.Context, error) AfterCommit(ctx context.Context, err error) (context.Context, error) BeforeRollback(ctx context.Context, err error) (context.Context, error) AfterRollback(ctx context.Context, err error) (context.Context, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.