Documentation
¶
Overview ¶
query is a tiny package for executing select-like queries and converting sql.Rows into slice of map[string]string The new map[string]string is allocated for each row. Keys are column names as seen in sql.
Index ¶
- func NewQueryWrap(db *sql.DB) *queryWrap
- func NewQueryWrapVoid(db *sql.DB) *queryWrapVoid
- type Row
- func Fetch(strQuery string, db *sql.DB) ([]Row, error)
- func FetchLimited(strQuery string, rowsLimit uint64, db *sql.DB) ([]Row, error)
- func Scan(dbRows *sql.Rows) ([]Row, error)
- func ScanLimited(dbRows *sql.Rows, rowsLimit uint64) ([]Row, error)
- func Select(strQuery string, db *sql.DB) ([]Row, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewQueryWrap ¶ added in v1.1.0
func NewQueryWrapVoid ¶ added in v1.1.0
Types ¶
type Row ¶
Row represents single line of database result.
Note: when you pass a map "by value" actually you pass a pointer to map struct
func Fetch ¶
Fetch is used to execute sql and convert expected rows to slice of map[string]string with keys as a column names.
func FetchLimited ¶
FetchLimited is used to execute sql query and convert expected rows to array of map[string]string with keys as a column names; no more than rowsLimit elements OR unlimited if 0.
func Scan ¶
Scan converts already executed query result into a slice of Row with keys as a column names.
func ScanLimited ¶
ScanLimited converts already executed query result into a slice of Row with keys as a column names; no more than rowsLimit elements OR unlimited if 0.