Documentation ¶
Index ¶
- func Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)
- func MySQLBuildQueryString(user, pass, dbname, host string, port int, sslmode string) string
- type MySQLDriver
- func (m *MySQLDriver) Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)
- func (m *MySQLDriver) Columns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)
- func (m *MySQLDriver) ForeignKeyInfo(schema, tableName string) ([]drivers.ForeignKey, error)
- func (MySQLDriver) Imports() (col importers.Collection, err error)
- func (m *MySQLDriver) PrimaryKeyInfo(schema, tableName string) (*drivers.PrimaryKey, error)
- func (m *MySQLDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error)
- func (MySQLDriver) Templates() (map[string]string, error)
- func (m *MySQLDriver) TranslateColumnType(drivers.Column) drivers.Column
- func (m *MySQLDriver) TranslateTableColumnType(c drivers.Column, tableName string) drivers.Column
- func (m *MySQLDriver) ViewCapabilities(schema, name string) (drivers.ViewCapabilities, error)
- func (m *MySQLDriver) ViewColumns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)
- func (m *MySQLDriver) ViewNames(schema string, whitelist, blacklist []string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) 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(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. Deprecated: for MySQL enum types to be created properly TranslateTableColumnType method should be used instead.
func (*MySQLDriver) TranslateTableColumnType ¶ added in v4.12.1
TranslateTableColumnType 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.
func (*MySQLDriver) ViewCapabilities ¶ added in v4.12.1
func (m *MySQLDriver) ViewCapabilities(schema, name string) (drivers.ViewCapabilities, error)
ViewCapabilities return what actions are allowed for a view.
func (*MySQLDriver) ViewColumns ¶ added in v4.12.1
func (*MySQLDriver) ViewNames ¶ added in v4.12.1
func (m *MySQLDriver) ViewNames(schema string, whitelist, blacklist []string) ([]string, error)
ViewNames connects to the postgres database and retrieves all view names from the information_schema where the view schema is schema. It uses a whitelist and blacklist.