sq

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Exec(ctx context.Context, sql string, prep PP) (sql.Result, error)
	Query(ctx context.Context, sql string, prep PP) (*sqlx.Rows, error)
	Ping(ctx context.Context) error
	BeginTransaction(ctx context.Context, iso sql.IsolationLevel) (Tx, error)
	SetListener(listener Listener)
}

func NewDB

func NewDB(db *sqlx.DB) DB

type Listener

type Listener interface {
	OnQuery(txID *uint16, sql string, params *PP)
	OnExec(txID *uint16, sql string, params *PP)
	OnPing()
	OnTxBegin(txid uint16)
	OnTxCommit(txid uint16)
	OnTxRollback(txid uint16)
}

type PP

type PP map[string]any

type Queryable

type Queryable interface {
	Exec(ctx context.Context, sql string, prep PP) (sql.Result, error)
	Query(ctx context.Context, sql string, prep PP) (*sqlx.Rows, error)
}

type Tx

type Tx interface {
	Rollback() error
	Commit() error
	Exec(ctx context.Context, sql string, prep PP) (sql.Result, error)
	Query(ctx context.Context, sql string, prep PP) (*sqlx.Rows, error)
}

func NewTransaction

func NewTransaction(xtx *sqlx.Tx, txid uint16, lstr Listener) Tx

Jump to

Keyboard shortcuts

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