sqlz

package
v0.0.57-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMustBePointer        = errors.New("sql: must be pointer")
	ErrMustNotNil           = errors.New("sql: must not nil")
	ErrDataTypeNotSupported = errors.New("sql: data type not supported")
)

Functions

func MustBeginTx

func MustBeginTx(ctx context.Context, db SQLTxBeginner, opts *sql.TxOptions) *sql.Tx

func ScanRows

func ScanRows(rows SQLRows, structTag string, destPointer interface{}) error

Types

type Queryer

type Queryer interface {
	QueryStructSliceContext(ctx context.Context, structTag string, destStructSlicePointer interface{}, query string, args ...any) error
	QueryStructContext(ctx context.Context, structTag string, destStructPointer interface{}, query string, args ...any) error
}

func NewDB

func NewDB(db SQLQueryer) Queryer

type SQLExecuter

type SQLExecuter interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

type SQLQueryer

type SQLQueryer interface {
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
}

type SQLRows

type SQLRows interface {
	Close() error
	Columns() ([]string, error)
	Next() bool
	Scan(...interface{}) error
	Err() error
}

type SQLTxBeginner

type SQLTxBeginner interface {
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

Jump to

Keyboard shortcuts

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