nest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: BSD-3-Clause Imports: 6 Imported by: 2

Documentation

Overview

package nest supports nested transactions allowing a common querier to be defined.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func (*Conn) BeginTx

func (c *Conn) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error)

func (*Conn) Commit

func (c *Conn) Commit() error

func (*Conn) Conn

func (c *Conn) Conn() *sql.Conn

func (*Conn) ExecContext

func (c *Conn) ExecContext(ctx context.Context, query string, args ...interface{}) (Result, error)

func (*Conn) PingContext

func (c *Conn) PingContext(ctx context.Context) error

func (*Conn) PrepareContext

func (c *Conn) PrepareContext(ctx context.Context, query string) (*Stmt, error)

func (*Conn) QueryContext

func (c *Conn) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*Conn) QueryRowContext

func (c *Conn) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row

func (*Conn) Rollback

func (c *Conn) Rollback() error

type DB

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

func Wrap

func Wrap(db *sql.DB) *DB

Wrap a sql.DB with a nestable DB.

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error)

func (*DB) Commit

func (db *DB) Commit() error

func (*DB) DB

func (db *DB) DB() *sql.DB

func (*DB) ExecContext

func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (Result, error)

func (*DB) PingContext

func (db *DB) PingContext(ctx context.Context) error

func (*DB) PrepareContext

func (db *DB) PrepareContext(ctx context.Context, query string) (*Stmt, error)

func (*DB) QueryContext

func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*DB) QueryRowContext

func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row

func (*DB) Rollback

func (db *DB) Rollback() error

type Querier

type Querier interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
	PingContext(ctx context.Context) error
	PrepareContext(ctx context.Context, query string) (*Stmt, error)
	Commit() error
	Rollback() error
}

Querier is the common interface to execute queries on a DB, Tx, or Conn.

type Result

type Result = sql.Result

type Row

type Row = sql.Row

type Rows

type Rows = sql.Rows

type Stmt

type Stmt = sql.Stmt

type Tx

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

func (*Tx) BeginTx

func (tx *Tx) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error)

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) ExecContext

func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (Result, error)

func (*Tx) PingContext

func (tx *Tx) PingContext(ctx context.Context) error

func (*Tx) PrepareContext

func (tx *Tx) PrepareContext(ctx context.Context, query string) (*Stmt, error)

func (*Tx) QueryContext

func (tx *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*Tx) QueryRowContext

func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row

func (*Tx) Rollback

func (tx *Tx) Rollback() error

func (*Tx) Tx

func (tx *Tx) Tx() *sql.Tx

type TxOptions

type TxOptions = sql.TxOptions

Jump to

Keyboard shortcuts

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