dbutil

package
v0.0.0-...-102af79 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package dbutil provides db utilities, complementing the more common ones in the original package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisPool

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

RedisPool is a contexted redis pool.

func NewRedisPool

func NewRedisPool(
	newFn func() (Conn, error),
	testFn func(c Conn, t time.Time) error,
	idleTimeout time.Duration,
	maxConcurrent int) *RedisPool

func (*RedisPool) Close

func (p *RedisPool) Close() error

func (*RedisPool) Get

func (p *RedisPool) Get(ctx context.Context) (Conn, error)

type SQLDB

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

SQLDB is a contexted sql DB.

func NewSQLDB

func NewSQLDB(db *DB, maxConcurrent int) *SQLDB

func (*SQLDB) Begin

func (d *SQLDB) Begin(ctx context.Context) (*SQLTx, error)

func (*SQLDB) Close

func (d *SQLDB) Close() error

func (*SQLDB) Exec

func (d *SQLDB) Exec(ctx context.Context,
	query string, args ...interface{}) (Result, error)

func (*SQLDB) Ping

func (d *SQLDB) Ping(ctx context.Context) error

func (*SQLDB) Prepare

func (d *SQLDB) Prepare(ctx context.Context,
	query string) (*SQLStmt, error)

func (*SQLDB) Query

func (d *SQLDB) Query(ctx context.Context,
	query string, args ...interface{}) (*Rows, error)

func (*SQLDB) QueryRow

func (d *SQLDB) QueryRow(ctx context.Context,
	query string, args ...interface{}) (*Row, error)

type SQLStmt

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

SQLStmt is a contexted sql Stmt.

func (*SQLStmt) Close

func (s *SQLStmt) Close() error

func (*SQLStmt) Exec

func (s *SQLStmt) Exec(ctx context.Context,
	args ...interface{}) (Result, error)

func (*SQLStmt) Query

func (s *SQLStmt) Query(ctx context.Context,
	args ...interface{}) (*Rows, error)

func (*SQLStmt) QueryRow

func (s *SQLStmt) QueryRow(ctx context.Context,
	args ...interface{}) (*Row, error)

type SQLTx

type SQLTx struct {
	*Tx
	// contains filtered or unexported fields
}

SQLTx is a contexted sql Tx.

func (*SQLTx) Commit

func (tx *SQLTx) Commit() error

func (*SQLTx) Rollback

func (tx *SQLTx) Rollback() error

Jump to

Keyboard shortcuts

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