Documentation
¶
Overview ¶
Package dbtrace provides OpenTelemetry tracing wrappers for database/sql operations.
Index ¶
- type DB
- func (d *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (d *DB) Close() error
- func (d *DB) DB() *sql.DB
- func (d *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *DB) PrepareContext(ctx context.Context, query string) (*Stmt, error)
- func (d *DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (d *DB) QueryRowContext(ctx context.Context, query string, args ...any) *Row
- type Row
- type Stmt
- type Tx
- func (t *Tx) Commit() error
- func (t *Tx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (t *Tx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (t *Tx) QueryRowContext(ctx context.Context, query string, args ...any) *Row
- func (t *Tx) Rollback() error
- func (t *Tx) Tx() *sql.Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps *sql.DB with OpenTelemetry tracing.
func (*DB) ExecContext ¶
ExecContext traces ExecContext calls.
func (*DB) PrepareContext ¶
PrepareContext prepares a traced statement.
func (*DB) QueryContext ¶
QueryContext traces QueryContext calls. Caller owns the returned *sql.Rows.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt represents a prepared traced database statement.
func (*Stmt) ExecContext ¶
ExecContext executes a prepared statement with tracing.
func (*Stmt) QueryContext ¶
QueryContext queries a prepared statement with tracing. Caller owns the returned *sql.Rows.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx wraps *sql.Tx with tracing.
func (*Tx) ExecContext ¶
ExecContext executes statement within transaction.
func (*Tx) QueryContext ¶
QueryContext executes query within transaction. Caller owns the returned *sql.Rows.
func (*Tx) QueryRowContext ¶
QueryRowContext executes single-row query within transaction.