sqltee

package module
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

README

Sqltee

Build Status Go Reference

Wrap Go database/sql/driver, interpolate query, log query and execution time and arguments (values, named values, transaction options).

Source files are distributed under the BSD-style license found in the LICENSE file.

Install

go get github.com/danil/sqltee@v0.31.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

func (Connector) Connect

func (c Connector) Connect(_ context.Context) (driver.Conn, error)

func (Connector) Driver

func (c Connector) Driver() driver.Driver

type Driver

type Driver struct {
	Driver driver.Driver
	Logger Logger
}

func (*Driver) Open

func (d *Driver) Open(name string) (driver.Conn, error)

func (*Driver) OpenConnector

func (d *Driver) OpenConnector(name string) (driver.Connector, error)

type Logger

type Logger interface {
	DriverOpen(d time.Duration, err error)
	ConnPrepare(d time.Duration, query string, err error)
	ConnClose(d time.Duration, err error)
	ConnBegin(d time.Duration, err error)
	ConnBeginTx(ctx context.Context, d time.Duration, opts driver.TxOptions, err error)
	ConnPrepareContext(ctx context.Context, d time.Duration, query string, err error)
	ConnExec(d time.Duration, query string, dargs []driver.Value, res driver.Result, err error)
	ConnExecContext(ctx context.Context, d time.Duration, query string, nvdargs []driver.NamedValue, res driver.Result, err error)
	ConnPing(d time.Duration, err error)
	ConnQuery(d time.Duration, query string, dargs []driver.Value, err error)
	ConnQueryContext(ctx context.Context, d time.Duration, query string, nvdargs []driver.NamedValue, err error)
	StmtClose(d time.Duration, err error)
	StmtExec(d time.Duration, query string, dargs []driver.Value, res driver.Result, err error)
	StmtExecContext(ctx context.Context, d time.Duration, query string, nvdargs []driver.NamedValue, res driver.Result, err error)
	StmtQuery(d time.Duration, query string, dargs []driver.Value, err error)
	StmtQueryContext(cxt context.Context, d time.Duration, query string, nvdargs []driver.NamedValue, err error)
	RowsNext(d time.Duration, dest []driver.Value, err error)
	TxCommit(d time.Duration, err error)
	TxRollback(d time.Duration, err error)
	Timer() Timer
}

type Timer

type Timer interface {
	Stop() time.Duration
}

Directories

Path Synopsis
examples
internal

Jump to

Keyboard shortcuts

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