Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilRows = errors.New("nil *sql.Rows as argument")
ErrNilRows a nil Rows interface is provided
Functions ¶
This section is empty.
Types ¶
type LookupMapper ¶
type LookupMapper struct {
// contains filtered or unexported fields
}
LookupMapper implements Mapper interface
type Mapper ¶
type Mapper interface {
//Get typeName should be sql type as is called in sql.ColumnType.DatabaseTypeName()
Get(typeName string, fallback reflect.Type) reflect.Type
//Type allow to set alias, extends or fix mapper behaviour
Type(t reflect.Type, asTypes ...string)
}
Mapper translate sql types to golang types
func DefaultMapper ¶
func DefaultMapper() Mapper
DefaultMapper provides a mapping for most common sql types type list reference used is: http://jakewheat.github.io/sql-overview/sql-2011-foundation-grammar.html#predefined-type
type Options ¶
type Options struct {
//Rows must be a valid sql.Rows object
Rows Rows
//Mapper can be nil, if so DefaultMapper is used
Mapper Mapper
}
Options for Scanner
type Rows ¶ added in v0.1.2
type Rows interface {
ColumnTypes() ([]*sql.ColumnType, error)
Columns() ([]string, error)
Next() bool
Err() error
Scan(...interface{}) error
}
Rows allow to mock sql.Rows object
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner read data from an sql.Rows object into a map
func NewScanner ¶
NewScanner create a new Scanner object, return an error if a nil Rows interface is provided or any error is returned by its
func (*Scanner) Scan ¶
Scan return true if there are rows in queue and false if there is no more rows or an error occurred. To distinguish between error or no more rows Err() method should be consulted