sqlz

package
v0.0.57-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 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 MustOpen

func MustOpen(ctx context.Context, driverName string, dataSourceName string) *sql.DB

func ScanRows

func ScanRows(rows sqlRows, structTag string, dst interface{}) error

ScanRows scans rows to dst.

dst must be a pointer.

Types

type NewDBOption added in v0.0.57

type NewDBOption interface {
	// contains filtered or unexported methods
}

func WithNewDBOptionStructTag added in v0.0.57

func WithNewDBOptionStructTag(structTag string) NewDBOption

type QueryerContext added in v0.0.57

type QueryerContext interface {
	// QueryContext executes a query that returns rows, typically a SELECT.
	//
	// The dst must be a pointer.
	// The args are for any placeholder parameters in the query.
	QueryContext(ctx context.Context, dst interface{}, query string, args ...interface{}) error
	// QueryRowContext executes a query that is expected to return at most one row.
	// It always returns a non-nil value or an error.
	//
	// The dst must be a pointer.
	// The args are for any placeholder parameters in the query.
	QueryRowContext(ctx context.Context, dst interface{}, query string, args ...interface{}) error
}

func NewDB

func NewDB(db sqlQueryerContext, opts ...NewDBOption) QueryerContext

Jump to

Keyboard shortcuts

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