Documentation
¶
Index ¶
- Variables
- func DefaultWithWidth(t string, unsigned bool) (string, bool)
- func IsConflictError(err error) bool
- func IsUnknownDatabaseError(err error) bool
- func ParseDSN(dsn string) (string, error)
- func ScanCatalog(ctx context.Context, a adaptor.Adaptor, database string) (builder.Catalog, error)
- func UnwrapError(err error) *mysql.MySQLError
- type TSchemaTableColumn
- type TSchemaTableIndex
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MustQuoteBases are the bases that must be quoted. MustQuoteBases = map[string]struct{}{ "CHAR": {}, "VARCHAR": {}, "TEXT": {}, "TINYTEXT": {}, "MEDIUMTEXT": {}, "LONGTEXT": {}, "BINARY": {}, "VARBINARY": {}, "BLOB": {}, "TINYBLOB": {}, "MEDIUMBLOB": {}, "LONGBLOB": {}, "DATETIME": {}, } DefaultKeywords = []string{ "CURRENT_TIMESTAMP", "NOW", "LOCALTIME", "LOCALTIMESTAMP", "UTC_TIMESTAMP", "NULL", "TRUE", "FALSE", } // TextBases can describe width by `information_schema.COLUMNS.character_maximum_length` TextBases = map[string]struct{}{ "CHAR": {}, "VARCHAR": {}, "TINYTEXT": {}, "TEXT": {}, "MEDIUMTEXT": {}, "LONGTEXT": {}, } // BinaryBases can describe width by `information_schema.COLUMNS.character_octet_length` BinaryBases = map[string]struct{}{ "BINARY": {}, "VARBINARY": {}, "TINYBLOB": {}, "BLOB": {}, "MEDIUMBLOB": {}, "LONGBLOB": {}, } // DatetimeBases can describe width by `information_schema.COLUMNS.datetime_precision` DatetimeBases = map[string]struct{}{ "TIME": {}, "DATETIME": {}, "TIMESTAMP": {}, } // IntegerBases can describe width by `information_schema.COLUMNS.numeric_precision` IntegerBases = map[string]struct{}{ "TINYINT": {}, "SMALLINT": {}, "MEDIUMINT": {}, "INT": {}, "INTEGER": {}, "BIGINT": {}, "BIT": {}, } // FloatBases can describe width by `information_schema.COLUMNS.numeric_precision` and // `information_schema.COLUMNS.numeric_precision` FloatBases = map[string]struct{}{ "DECIMAL": {}, "NUMERIC": {}, "FLOAT": {}, "DOUBLE": {}, } TextBasesDefaultWidth = map[string]uint64{ "CHAR": 1, "TINYTEXT": 255, "TEXT": 65535, "MEDIUMTEXT": 16777215, "LONGTEXT": 4294967295, } BinaryBasesDefaultWidth = map[string]uint64{ "BINARY": 1, "TINYBLOB": 255, "BLOB": 65535, "MEDIUMBLOB": 16777215, "LONGBLOB": 4294967295, } DatetimeBasesDefaultPrecision = map[string]uint64{ "TIME": 0, "DATETIME": 0, "TIMESTAMP": 0, } UnsignedIntegerBasesDefaultWidth = map[string]uint64{ "TINYINT": 4, "SMALLINT": 6, "MEDIUMINT": 9, "INT": 11, "INTEGER": 11, "BIGINT": 20, "BIT": 1, } IntegerBasesDefaultWidth = map[string]uint64{ "TINYINT": 3, "SMALLINT": 5, "MEDIUMINT": 8, "INT": 10, "INTEGER": 10, "BIGINT": 20, "BIT": 1, } FloatBasesDefaultWidth = map[string]uint64{ "DECIMAL": 10, "NUMERIC": 10, "FLOAT": 12, "DOUBLE": 22, } FloatBasesDefaultPrecision = map[string]uint64{ "DECIMAL": 0, "NUMERIC": 0, } )
Functions ¶
func IsConflictError ¶
func IsUnknownDatabaseError ¶
func ScanCatalog ¶
func UnwrapError ¶
func UnwrapError(err error) *mysql.MySQLError
Types ¶
type TSchemaTableColumn ¶
type TSchemaTableColumn struct {
TableSchema string `db:"table_schema"`
Table string `db:"table_name"`
ColumnName string `db:"column_name"`
RawDataType string `db:"data_type"`
DataType string `db:"column_type"`
VarcharLength *uint64 `db:"character_maximum_length"` // char,varchar
BinaryLength *uint64 `db:"character_octet_length"` // binary,varbinary
DatetimePrecision *uint64 `db:"datetime_precision"` // datetime/timestamp/time
NumericWidth *uint64 `db:"numeric_precision"` // decimal,numeric,float,double
NumericPrecision *uint64 `db:"numeric_scale"` // decimal,numeric
DefaultValue *string `db:"column_default"`
IsNullable string `db:"is_nullable"`
Comment string `db:"column_comment"`
Extra string `db:"extra"`
OrdinalPosition string `db:"ordinal_position"`
}
func (TSchemaTableColumn) TableName ¶
func (TSchemaTableColumn) TableName() string
func (*TSchemaTableColumn) ToCol ¶
func (t *TSchemaTableColumn) ToCol() builder.Col
type TSchemaTableIndex ¶
type TSchemaTableIndex struct {
TableSchema string `db:"table_schema"`
IndexType string `db:"index_type"`
IndexName string `db:"index_name"`
NonUnique int `db:"non_unique"`
Table string `db:"table_name"`
ColumnName string `db:"column_name"`
SeqInIndex int `db:"seq_in_index"`
}
func (TSchemaTableIndex) TableName ¶
func (TSchemaTableIndex) TableName() string
Click to show internal directories.
Click to hide internal directories.