qrm

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: Apache-2.0, BSD-3-Clause, MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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