Documentation ¶
Index ¶
- type Conn
- func (c *Conn) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Conn) Close(ctx context.Context) error
- func (c *Conn) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (c *Conn) Ping(ctx context.Context) error
- func (c *Conn) Prepare(ctx context.Context, query string) (*Stmt, error)
- func (c *Conn) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (c *Conn) QueryRow(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) Close(ctx context.Context) error
- func (db *DB) Conn(ctx context.Context) (*Conn, error)
- func (db *DB) DB() *sql.DB
- func (db *DB) Driver(ctx context.Context) driver.Driver
- func (db *DB) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (db *DB) Ping(ctx context.Context) error
- func (db *DB) Prepare(ctx context.Context, query string) (*Stmt, error)
- func (db *DB) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (db *DB) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (db *DB) SetConnMaxLifetime(d time.Duration)
- func (db *DB) SetMaxIdleConns(n int)
- func (db *DB) SetMaxOpenConns(n int)
- func (db *DB) Stats(ctx context.Context) sql.DBStats
- type DSNInfo
- type Stmt
- type Tx
- func (tx *Tx) Commit(ctx context.Context) error
- func (tx *Tx) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) Prepare(ctx context.Context, query string) (*Stmt, error)
- func (tx *Tx) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (tx *Tx) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (tx *Tx) Rollback(ctx context.Context) error
- func (tx *Tx) Stmt(ctx context.Context, stmt *Stmt) *Stmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a single database connection.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB contains the underlying db to be traced.
func FromDB ¶
FromDB wraps an opened db. This allows to support libraries that provide *sql.DB like sqlmock.
func (*DB) DB ¶
DB returns the underlying db. This is useful for SQL code that does not require tracing.
func (*DB) Ping ¶
Ping verifies a connection to the database is still alive, establishing a connection if necessary.
func (*DB) SetConnMaxLifetime ¶
SetConnMaxLifetime sets the maximum amount of time a connection may be reused.
func (*DB) SetMaxIdleConns ¶
SetMaxIdleConns sets the maximum number of connections in the idle connection pool.
func (*DB) SetMaxOpenConns ¶
SetMaxOpenConns sets the maximum number of open connections to the database.
type DSNInfo ¶
DSNInfo contains information extracted from a valid connection string. Additional parameters provided are discarded.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt is a prepared statement.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is an in-progress database transaction.