driver

package
Version: v3.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

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 is more useful for calling into the library so you don't have to instantiate an empty type.

func Asset

func Asset(name string) ([]byte, error)

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 AssetDigest

func AssetDigest(name string) ([sha256.Size]byte, error)

AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

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, and AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

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 AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func AssetString

func AssetString(name string) (string, error)

AssetString returns the asset contents as a string (instead of a []byte).

func Digests

func Digests() (map[string][sha256.Size]byte, error)

Digests returns a map of all known files and their checksums.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustAssetString

func MustAssetString(name string) string

MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MySQLBuildQueryString

func MySQLBuildQueryString(user, pass, dbname, host string, port int, sslmode string) string

MySQLBuildQueryString builds a query string for MySQL.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory.

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively.

Types

type MySQLDriver

type MySQLDriver struct {
	// contains filtered or unexported fields
}

MySQLDriver holds the database connection string and a handle to the database connection.

func (*MySQLDriver) Assemble

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

Assemble all the information we need to provide back to the driver

func (*MySQLDriver) Columns

func (m *MySQLDriver) 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 information_schema.columns. 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 (*MySQLDriver) ForeignKeyInfo

func (m *MySQLDriver) ForeignKeyInfo(schema, tableName string) ([]drivers.ForeignKey, error)

ForeignKeyInfo retrieves the foreign keys for a given table name.

func (MySQLDriver) Imports

func (MySQLDriver) Imports() (col importers.Collection, err error)

Imports returns important imports for the driver

func (*MySQLDriver) PrimaryKeyInfo

func (m *MySQLDriver) PrimaryKeyInfo(schema, tableName string) (*drivers.PrimaryKey, error)

PrimaryKeyInfo looks up the primary key for a table.

func (*MySQLDriver) TableNames

func (m *MySQLDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error)

TableNames connects to the mysql database and retrieves all table names from the information_schema where the table schema is public.

func (MySQLDriver) Templates

func (MySQLDriver) Templates() (map[string]string, error)

Templates that should be added/overridden

func (*MySQLDriver) TranslateColumnType

func (m *MySQLDriver) TranslateColumnType(c drivers.Column) drivers.Column

TranslateColumnType converts mysql database types to Go types, for example "varchar" to "string" and "bigint" to "int64". It returns this parsed data as a Column object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL