Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTypeMap = map[Type]reflect.Type{ {IntegerAffinity, true, ""}: reflect.TypeOf(int64(0)), {IntegerAffinity, false, ""}: reflect.TypeOf(sql.NullInt64{}), {TextAffinity, true, ""}: reflect.TypeOf(""), {TextAffinity, false, ""}: reflect.TypeOf(sql.NullString{}), {BlobAffinity, true, ""}: reflect.SliceOf(reflect.TypeOf(byte(0))), {BlobAffinity, false, ""}: reflect.SliceOf(reflect.TypeOf(byte(0))), {RealAffinity, true, ""}: reflect.TypeOf(float64(0)), {RealAffinity, false, ""}: reflect.TypeOf(sql.NullFloat64{}), {NumericAffinity, true, "BOOLEAN"}: reflect.TypeOf(false), {NumericAffinity, false, "BOOLEAN"}: reflect.TypeOf(sql.NullBool{}), {NumericAffinity, true, "DATE"}: reflect.TypeOf(time.Time{}), {NumericAffinity, false, "DATE"}: reflect.TypeOf(sql.NullTime{}), {NumericAffinity, true, "DATETIME"}: reflect.TypeOf(time.Time{}), {NumericAffinity, false, "DATETIME"}: reflect.TypeOf(sql.NullTime{}), {NumericAffinity, true, "TIMESTAMP"}: reflect.TypeOf(time.Time{}), {NumericAffinity, false, "TIMESTAMP"}: reflect.TypeOf(sql.NullTime{}), {NumericAffinity, true, ""}: reflect.SliceOf(reflect.TypeOf(byte(0))), {NumericAffinity, false, ""}: reflect.SliceOf(reflect.TypeOf(byte(0))), }
Functions ¶
Types ¶
type Affinity ¶ added in v0.0.15
type Affinity int
SQLite type affinity as described here https://sqlite.org/datatype3.html#type_affinity
func TypeAffinity ¶ added in v0.0.15
TypeAffinity implements SQLites rules for type affinity.
https://sqlite.org/datatype3.html#determination_of_column_affinity
type DB ¶
DB accesses a SQLite database to read data about tables, columns, etc.
func New ¶
New initializes a DB to read data from a SQLite database.
dsn is the filename of the SQLite database. typeMap is the mapping from database types to go types which should be used.
any error opening the sqlite database is returned.
func (*DB) Columns ¶
Columns returns all columns of a table.
func (*DB) Foreign ¶ added in v0.0.7
Foreign returns all foreign key constrains of a table.
func (*DB) Primary ¶
Primary returns all columns of a table which form the primary key.
func (*DB) Tables ¶
Tables returns all tables found in the database.