Documentation ¶
Overview ¶
Package driver is an sqlite driver.
Index ¶
- func Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func SQLiteBuildQueryString(file string) string
- type SQLiteDriver
- func (s SQLiteDriver) Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)
- func (s SQLiteDriver) Close()
- func (s SQLiteDriver) Columns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)
- func (s SQLiteDriver) ForeignKeyInfo(schema, tableName string) ([]drivers.ForeignKey, error)
- func (SQLiteDriver) Imports() (col importers.Collection, err error)
- func (s SQLiteDriver) Open() error
- func (s SQLiteDriver) PrimaryKeyInfo(schema, tableName string) (*drivers.PrimaryKey, error)
- func (s SQLiteDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error)
- func (s SQLiteDriver) Templates() (map[string]string, error)
- func (SQLiteDriver) TranslateColumnType(c drivers.Column) drivers.Column
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func SQLiteBuildQueryString ¶
SQLiteBuildQueryString builds a query string for SQLite.
Types ¶
type SQLiteDriver ¶
type SQLiteDriver struct {
// contains filtered or unexported fields
}
SQLiteDriver holds the database connection string and a handle to the database connection.
func (SQLiteDriver) Columns ¶
func (s SQLiteDriver) Columns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)
Columns takes a table name and attempts to retrieve the table information from the database. It retrieves the column names and column types and returns those as a []Column after TranslateColumnType() converts the SQL types to Go types, for example: "varchar" to "string"
func (SQLiteDriver) ForeignKeyInfo ¶
func (s SQLiteDriver) ForeignKeyInfo(schema, tableName string) ([]drivers.ForeignKey, error)
ForeignKeyInfo retrieves the foreign keys for a given table name.
func (SQLiteDriver) Imports ¶
func (SQLiteDriver) Imports() (col importers.Collection, err error)
Imports returns important imports for the driver
func (SQLiteDriver) Open ¶
func (s SQLiteDriver) Open() error
Open opens the database connection using the connection string
func (SQLiteDriver) PrimaryKeyInfo ¶
func (s SQLiteDriver) PrimaryKeyInfo(schema, tableName string) (*drivers.PrimaryKey, error)
PrimaryKeyInfo looks up the primary key for a table.
func (SQLiteDriver) TableNames ¶
func (s SQLiteDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error)
TableNames connects to the sqlite database and retrieves all table names from sqlite_master
func (SQLiteDriver) Templates ¶
func (s SQLiteDriver) Templates() (map[string]string, error)
Templates for the driver
func (SQLiteDriver) TranslateColumnType ¶
func (SQLiteDriver) TranslateColumnType(c drivers.Column) drivers.Column
TranslateColumnType converts sqlite database types to Go types, for example "varchar" to "string" and "bigint" to "int64". It returns this parsed data as a Column object. https://sqlite.org/datatype3.html