helpers

package
v0.0.0-...-313f127 Latest Latest
Warning

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

Go to latest
Published: May 6, 2016 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(tx *sqlx.Tx, constructor constructorFunc, query string, ids ...interface{}) (interface{}, error)

Get is an internal function for getting one element from SQL by ID and parsing the element as a struct. If the query returns an empty result set the function will return nil (and no error).

  • tx is a transaction used to execute the SQL
  • constructor is a function that returns a pointer to a prototype element (i.e. `new(MyStruct)`).
  • query is the actual SQL statement (with parameter placeholders).
  • ids is one or more ID used to identify the of the object to retrieve (one per placeholder in the the query)

func GetAll

func GetAll(tx *sqlx.Tx, constructor constructorFunc, query string, params ...interface{}) ([]interface{}, error)

GetAll is an internal function for retrieving a set of rows and parsing each of them as a struct. - tx is a transaction used to execute the SQL - constructor is a function that returns a pointer to a prototype element (i.e. `new(MyStruct)`). - query is the actual SQL statement (with parameter placeholders). - params is the parameters user to replace the placeholders in the SQL statement

Types

This section is empty.

Jump to

Keyboard shortcuts

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