Documentation ¶
Index ¶
- Constants
- Variables
- func Args(args ...any) []any
- func ExecNoPrepare(db *sql.DB, query string, args ...any) (res sql.Result, err error)
- func GetDB(mysql_uri string) (*sql.DB, bool, error)
- func GetGenericDB(driverName, dataSourceName string) (*sql.DB, bool, error)
- func GetSQLiteDB(dbFile string) (*sql.DB, bool, error)
- func IsAlterTable(statement string) bool
- func IsCreateIndex(statement string) bool
- func IsCreateTable(statement string) bool
- func IsDropIndex(statement string) bool
- func IsInsert(statement string) bool
- func NilIfZero(i int64) any
- func QueryRowsMap(db *sql.DB, query string, on_row func(RowMap) error, args ...any) (err error)
- func ScanRowsToArrays(rows *sql.Rows, on_row func([]CellData) error) error
- func ScanRowsToMaps(rows *sql.Rows, on_row func(RowMap) error) error
- func ToSqlite3CreateTable(statement string) string
- func ToSqlite3Dialect(statement string) (translated string)
- func ToSqlite3Insert(statement string) string
- type CellData
- type NamedResultData
- type ResultData
- type RowData
- type RowMap
- func (this *RowMap) GetBool(key string) bool
- func (this *RowMap) GetInt(key string) int
- func (this *RowMap) GetInt32(key string) int32
- 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) GetStringD(key string, def string) string
- func (this *RowMap) GetTime(key string) time.Time
- func (this *RowMap) GetUint(key string) uint
- func (this *RowMap) GetUint32(key string) uint32
- func (this *RowMap) GetUint64(key string) uint64
- func (this *RowMap) GetUint64D(key string, def uint64) uint64
- func (this *RowMap) GetUintD(key string, def uint) uint
Constants ¶
const DateTimeFormat = "2006-01-02 15:04:05.999999"
Variables ¶
var EmptyResultData = ResultData{}
Functions ¶
func ExecNoPrepare ¶
ExecNoPrepare executes given query using given args on given DB, without using prepared statements.
func GetDB ¶
GetDB returns a MySQL DB instance based on uri. bool result indicates whether the DB was returned from cache; err
func GetGenericDB ¶
GetGenericDB returns a DB instance based on uri. bool result indicates whether the DB was returned from cache; err
func GetSQLiteDB ¶
GetSQLiteDB returns a SQLite DB instance based on DB file name. bool result indicates whether the DB was returned from cache; err
func IsAlterTable ¶
func IsCreateIndex ¶
func IsCreateTable ¶
func IsDropIndex ¶
func QueryRowsMap ¶
QueryRowsMap is a convenience function allowing querying a result set while poviding a callback function activated per read row.
func ScanRowsToArrays ¶
ScanRowsToArrays is a convenience function, typically not called directly, which maps rows already read from the databse into arrays of NullString
func ScanRowsToMaps ¶
ScanRowsToMaps is a convenience function, typically not called directly, which maps rows already read from the databse into RowMap entries.
func ToSqlite3CreateTable ¶
func ToSqlite3Dialect ¶
func ToSqlite3Insert ¶
Types ¶
type CellData ¶
type CellData sql.NullString
CellData is the result of a single (atomic) column in a single row
func RowToArray ¶
RowToArray is a convenience function, typically not called directly, which maps a single read database row into a NullString
func (*CellData) MarshalJSON ¶
func (*CellData) NullString ¶
func (this *CellData) NullString() *sql.NullString
func (*CellData) UnmarshalJSON ¶
UnmarshalJSON reds this object from JSON
type NamedResultData ¶
type NamedResultData struct { Columns []string Data ResultData }
type RowData ¶
type RowData []CellData
RowData is the result of a single row, in positioned array format
func (*RowData) MarshalJSON ¶
MarshalJSON will marshal this map as JSON
type RowMap ¶
RowMap represents one row in a result set. Its objective is to allow for easy, typed getters by column name.
func (*RowMap) GetStringD ¶
GetStringD returns a string from the map, or a default value if the key does not exist