driver

package
v4.16.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package driver is an sqlite driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assemble

func Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)

Assemble the db info

func SQLiteBuildQueryString

func SQLiteBuildQueryString(file string) string

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) Assemble

func (s SQLiteDriver) Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)

Assemble the db info

func (SQLiteDriver) Close

func (s SQLiteDriver) Close()

Close closes 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 that should be added/overridden

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

func (SQLiteDriver) ViewCapabilities

func (s SQLiteDriver) ViewCapabilities(schema, name string) (drivers.ViewCapabilities, error)

ViewCapabilities return what actions are allowed for a view.

func (SQLiteDriver) ViewColumns

func (s SQLiteDriver) ViewColumns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)

func (SQLiteDriver) ViewNames

func (s SQLiteDriver) ViewNames(schema string, whitelist, blacklist []string) ([]string, error)

ViewNames connects to the sqlite database and retrieves all view names from sqlite_master

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL