sqltee

package module
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

README

sqltee

Build Status Go Reference

SQL database/sql/driver wrapper, execution time logger, query interpolator and logger, arguments logger (values, named values, transaction options) for Go.

Source files are distributed under the BSD-style license.

About

The software is considered to be at a alpha level of readiness - its extremely slow and allocates a lots of memory)

Benchmark

$ go test -run ^NOTHING -bench BenchmarkGob\$
goos: linux
goarch: amd64
pkg: github.com/danil/sqltee/examples/teegob
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
BenchmarkGob/gob_test.go:53/query_from_existing_table-8                 2379        510046 ns/op
PASS
ok      github.com/danil/sqltee/examples/teegob 1.270s

Documentation

Overview

Package sqltee wrap database/sql/driver, interpolate query, log query and execution time and arguments (values, named values, transaction options).

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