fsql

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package fsql provides database/sql utilities.

Index

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 *database/sql.DB with tracing, metrics, logging, and resource tracking.

func WrapDB

func WrapDB(db *sql.DB, name string, l *zap.Logger) *DB

WrapDB creates a new DB.

Name is used for metric label values, etc. Logger (that will be named) is used for query logging.

func (*DB) Close

func (db *DB) Close() error

Close implements sqlDB.

func (DB) Collect

func (c DB) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (DB) Describe

func (c DB) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (*DB) ExecContext

func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

ExecContext implements sqlDB.

func (*DB) QueryContext

func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

QueryContext implements sqlDB.

func (*DB) QueryRowContext

func (db *DB) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

QueryRowContext implements sqlDB.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL