Documentation
¶
Overview ¶
Package sql is a plugin that can be used to trace database/sql.
Index ¶
- Variables
- type Conn
- func (c *Conn) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Conn) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (c *Conn) PingContext(ctx context.Context) error
- func (c *Conn) PrepareContext(ctx context.Context, query string) (*Stmt, error)
- func (c *Conn) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (c *Conn) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- type DB
- func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (db *DB) Conn(ctx context.Context) (*Conn, error)
- func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (db *DB) PingContext(ctx context.Context) error
- func (db *DB) PrepareContext(ctx context.Context, query string) (*Stmt, error)
- func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- type DBType
- type Option
- type Stmt
- type Tx
- func (tx *Tx) Commit() (err error)
- func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) Prepare(query string) (*Stmt, error)
- func (tx *Tx) PrepareContext(ctx context.Context, query string) (*Stmt, error)
- func (tx *Tx) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tx *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (tx *Tx) QueryRow(query string, args ...interface{}) *sql.Row
- func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (tx *Tx) Rollback() (err error)
- func (tx *Tx) StmtContext(ctx context.Context, stmt *Stmt) *Stmt
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedOp = errors.New("operation unsupported by the underlying driver")
ErrUnsupportedOp operation unsupported by the underlying driver
Functions ¶
This section is empty.
Types ¶
type Conn ¶
Conn wrap sql.Conn and support trace
func (*Conn) ExecContext ¶
func (c *Conn) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext support trace
func (*Conn) PingContext ¶
PingContext support trace
func (*Conn) PrepareContext ¶
PrepareContext support trace
type DB ¶
DB wrap sql.DB and support trace
func (*DB) ExecContext ¶
func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext support trace
func (*DB) PingContext ¶
PingContext support trace
func (*DB) PrepareContext ¶
PrepareContext support trace
type Option ¶
type Option func(*options)
Option set plugin option
func WithParamReport ¶
func WithParamReport() Option
WithParamReport if set, the parameters of the sql would be collected
func WithPeerAddr ¶
WithPeerAddr set the peer address to report
func WithQueryReport ¶
func WithQueryReport() Option
WithQueryReport if set, the sql would be collected
func WithSQLDBType ¶
WithSQLDBType set dbType option, dbType is used for parsing dsn string to peer address and setting componentID, if DB type is not support in DBType list, please use WithPeerAddr to set peer address manually
type Stmt ¶
Stmt wrap sql.Stmt and support trace
func (*Stmt) ExecContext ¶
ExecContext support trace
func (*Stmt) QueryContext ¶
QueryContext support trace
type Tx ¶
Tx wrap sql.Tx and support trace
func (*Tx) ExecContext ¶
func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext support trace
func (*Tx) PrepareContext ¶
PrepareContext support trace
func (*Tx) QueryContext ¶
func (tx *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryContext support trace
func (*Tx) QueryRowContext ¶
QueryRowContext support trace