Documentation ¶
Index ¶
- func Driver(driver driver.Driver, intr Interceptor) driver.Driver
- type Interceptor
- type NullInterceptor
- func (NullInterceptor) ConnBeginTx(ctx context.Context, conn driver.ConnBeginTx, txOpts driver.TxOptions) (driver.Tx, error)
- func (NullInterceptor) ConnExecContext(ctx context.Context, conn driver.ExecerContext, query string, ...) (driver.Result, error)
- func (NullInterceptor) ConnPing(ctx context.Context, conn driver.Pinger) error
- func (NullInterceptor) ConnPrepareContext(ctx context.Context, conn driver.ConnPrepareContext, query string) (driver.Stmt, error)
- func (NullInterceptor) ConnQueryContext(ctx context.Context, conn driver.QueryerContext, query string, ...) (driver.Rows, error)
- func (NullInterceptor) ConnectorConnect(ctx context.Context, connect driver.Connector) (driver.Conn, error)
- func (NullInterceptor) ResultLastInsertId(res driver.Result) (int64, error)
- func (NullInterceptor) ResultRowsAffected(res driver.Result) (int64, error)
- func (NullInterceptor) RowsNext(ctx context.Context, rows driver.Rows, dest []driver.Value) error
- func (NullInterceptor) StmtClose(ctx context.Context, stmt driver.Stmt) error
- func (NullInterceptor) StmtExecContext(ctx context.Context, stmt driver.StmtExecContext, _ string, ...) (driver.Result, error)
- func (NullInterceptor) StmtQueryContext(ctx context.Context, stmt driver.StmtQueryContext, _ string, ...) (driver.Rows, error)
- func (NullInterceptor) TxCommit(ctx context.Context, tx driver.Tx) error
- func (NullInterceptor) TxRollback(ctx context.Context, tx driver.Tx) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Driver ¶
func Driver(driver driver.Driver, intr Interceptor) driver.Driver
Driver returns the supplied driver.Driver with a new object that has all of its calls intercepted by the supplied Interceptor object.
Important note: Seeing as the context passed into the various instrumentation calls this package calls, Any call without a context passed will not be intercepted. Please be sure to use the ___Context() and BeginTx() function calls added in Go 1.8 instead of the older calls which do not accept a context.
Types ¶
type Interceptor ¶
type Interceptor interface { // Connection interceptors ConnBeginTx(context.Context, driver.ConnBeginTx, driver.TxOptions) (driver.Tx, error) ConnPrepareContext(context.Context, driver.ConnPrepareContext, string) (driver.Stmt, error) ConnPing(context.Context, driver.Pinger) error ConnExecContext(context.Context, driver.ExecerContext, string, []driver.NamedValue) (driver.Result, error) ConnQueryContext(context.Context, driver.QueryerContext, string, []driver.NamedValue) (driver.Rows, error) // Connector interceptors ConnectorConnect(context.Context, driver.Connector) (driver.Conn, error) // Results interceptors ResultLastInsertId(driver.Result) (int64, error) ResultRowsAffected(driver.Result) (int64, error) // Rows interceptors RowsNext(context.Context, driver.Rows, []driver.Value) error // Stmt interceptors StmtExecContext(context.Context, driver.StmtExecContext, string, []driver.NamedValue) (driver.Result, error) StmtQueryContext(context.Context, driver.StmtQueryContext, string, []driver.NamedValue) (driver.Rows, error) StmtClose(context.Context, driver.Stmt) error // Tx interceptors TxCommit(context.Context, driver.Tx) error TxRollback(context.Context, driver.Tx) error }
type NullInterceptor ¶
type NullInterceptor struct{}
NullInterceptor is a complete passthrough interceptor that implements every method of the Interceptor interface and performs no additional logic. Users should Embed it in their own interceptor so that they only need to define the specific functions they are interested in intercepting.
func (NullInterceptor) ConnBeginTx ¶
func (NullInterceptor) ConnBeginTx(ctx context.Context, conn driver.ConnBeginTx, txOpts driver.TxOptions) (driver.Tx, error)
func (NullInterceptor) ConnExecContext ¶
func (NullInterceptor) ConnExecContext(ctx context.Context, conn driver.ExecerContext, query string, args []driver.NamedValue) (driver.Result, error)
func (NullInterceptor) ConnPrepareContext ¶
func (NullInterceptor) ConnPrepareContext(ctx context.Context, conn driver.ConnPrepareContext, query string) (driver.Stmt, error)
func (NullInterceptor) ConnQueryContext ¶
func (NullInterceptor) ConnQueryContext(ctx context.Context, conn driver.QueryerContext, query string, args []driver.NamedValue) (driver.Rows, error)
func (NullInterceptor) ConnectorConnect ¶
func (NullInterceptor) ResultLastInsertId ¶
func (NullInterceptor) ResultLastInsertId(res driver.Result) (int64, error)
func (NullInterceptor) ResultRowsAffected ¶
func (NullInterceptor) ResultRowsAffected(res driver.Result) (int64, error)
func (NullInterceptor) StmtExecContext ¶
func (NullInterceptor) StmtExecContext(ctx context.Context, stmt driver.StmtExecContext, _ string, args []driver.NamedValue) (driver.Result, error)
func (NullInterceptor) StmtQueryContext ¶
func (NullInterceptor) StmtQueryContext(ctx context.Context, stmt driver.StmtQueryContext, _ string, args []driver.NamedValue) (driver.Rows, error)