qrm

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0, BSD-3-Clause, MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRows = errors.New("qrm: no rows in result set")

ErrNoRows is returned by Query when query result set is empty

Functions

func Query

func Query(ctx context.Context, db DB, query string, args []interface{}, destPtr interface{}) error

Query executes Query Result Mapping (QRM) of `query` with list of parametrized arguments `arg` over database connection `db` using context `ctx` into destination `destPtr`. Destination can be either pointer to struct or pointer to slice of structs. If destination is pointer to struct and query result set is empty, method returns qrm.ErrNoRows.

Types

type DB

type DB interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

DB is common database interface used by jet execution

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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