Documentation ¶
Index ¶
- func Exec(db *sql.DB, query string, args ...interface{}) (sql.Result, error)
- func GetDB(mysql_uri string) (*sql.DB, bool, error)
- func QueryRowsMap(db *sql.DB, query string, on_row func(RowMap) error) error
- func RowToArray(rows *sql.Rows, columns []string) []sql.NullString
- func ScanRowsToArrays(rows *sql.Rows, on_row func([]sql.NullString) error) error
- func ScanRowsToMaps(rows *sql.Rows, on_row func(RowMap) error) error
- type RowMap
- func (this *RowMap) GetBool(key string) bool
- func (this *RowMap) GetInt(key string) int
- func (this *RowMap) GetInt64(key string) int64
- func (this *RowMap) GetIntD(key string, def int) int
- func (this *RowMap) GetNullInt64(key string) sql.NullInt64
- func (this *RowMap) GetString(key string) string
- func (this *RowMap) GetUint(key string) uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec executes given query using given args on given DB. It will safele prepare, execute and close the statement.
func GetDB ¶
GetDB returns a DB instance based on uri. bool result indicates whether the DB was returned from cache; err
func QueryRowsMap ¶
QueryRowsMap is a convenience function allowing querying a result set while poviding a callback function activated per read row.
func RowToArray ¶
func RowToArray(rows *sql.Rows, columns []string) []sql.NullString
RowToArray is a convenience function, typically not called directly, which maps a single read database row into a NullString
func ScanRowsToArrays ¶
ScanRowsToArrays is a convenience function, typically not called directly, which maps rows already read from the databse into arrays of NullString
Types ¶
type RowMap ¶
type RowMap map[string]sql.NullString
RowMap represents one row in a result set. Its objective is to allow for easy, typed getters by column name.