Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CanonicalToMariaDBTypes = map[string]string{
"bool": "TINYINT(1)",
"int8": "TINYINT",
"int16": "SMALLINT",
"int": "INT",
"int32": "INT",
"int64": "BIGINT",
"uint": "INT UNSIGNED",
"uint8": "TINYINT UNSIGNED",
"uint16": "SMALLINT UNSIGNED",
"uint32": "INT UNSIGNED",
"uint64": "BIGINT UNSIGNED",
"float32": "FLOAT",
"float64": "DOUBLE",
"decimal": "DECIMAL",
"string": "VARCHAR(255)",
"text": "TEXT",
"date": "DATE",
"time": "TIME",
"timestamp": "DATETIME",
"timestamptz": "DATETIME",
"uuid": "CHAR(36)",
"json": "JSON",
"jsonb": "JSON",
"bytea": "BLOB",
}
CanonicalToMariaDBTypes maps canonical types to MariaDB/MySQL types.
var MariaDBToCanonicalTypes = map[string]string{
"tinyint": "int8",
"smallint": "int16",
"mediumint": "int",
"int": "int",
"integer": "int",
"int2": "int16",
"int4": "int",
"int8": "int64",
"bigint": "int64",
"boolean": "bool",
"bool": "bool",
"bit": "bool",
"float": "float32",
"double": "float64",
"real": "float64",
"double precision": "float64",
"decimal": "decimal",
"numeric": "decimal",
"dec": "decimal",
"fixed": "decimal",
"char": "string",
"character": "string",
"varchar": "string",
"nchar": "string",
"nvarchar": "string",
"tinytext": "text",
"text": "text",
"mediumtext": "text",
"longtext": "text",
"binary": "bytea",
"varbinary": "bytea",
"tinyblob": "bytea",
"blob": "bytea",
"mediumblob": "bytea",
"longblob": "bytea",
"date": "date",
"time": "time",
"datetime": "timestamp",
"timestamp": "timestamp",
"year": "int",
"json": "json",
"enum": "string",
"set": "string",
"uuid": "uuid",
}
MariaDBToCanonicalTypes maps MariaDB/MySQL type names to canonical types.
var MariaDBTypeSynonyms = map[string]string{
"integer": "int",
"int2": "smallint",
"int4": "int",
"int8": "bigint",
"double precision": "double",
"character": "char",
"dec": "decimal",
"fixed": "decimal",
"numeric": "decimal",
"boolean": "tinyint",
"bool": "tinyint",
}
MariaDBTypeSynonyms maps MariaDB/MySQL type aliases to their canonical MariaDB name.
Functions ¶
func ConvertCanonicalToMariaDB ¶
ConvertCanonicalToMariaDB converts a canonical type to a MariaDB/MySQL type. Defaults to VARCHAR(255) for unrecognised types.
func ConvertMariaDBToCanonical ¶
ConvertMariaDBToCanonical converts a MariaDB/MySQL type name to the canonical type. Strips dimension parameters and normalizes aliases. Defaults to "string".
func NormalizeMariaDBType ¶
NormalizeMariaDBType maps a MariaDB/MySQL base type (no dimension parameters) to its canonical MariaDB form. Unknown types are returned as-is (lowercased).
Types ¶
This section is empty.