You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.5 KiB
Go

package cnf
6 years ago
// EImportsHead imports head options. import包含选项
var EImportsHead = map[string]string{
"stirng": `"string"`,
"time.Time": `"time"`,
"gorm.Model": `"gorm.io/gorm"`,
5 years ago
"fmt": `"fmt"`,
}
5 years ago
// TypeMysqlDicMp Accurate matching type.精确匹配类型
var TypeMysqlDicMp = map[string]string{
"smallint": "int16",
"smallint unsigned": "uint16",
5 years ago
"int": "int",
"int unsigned": "uint",
5 years ago
"bigint": "int64",
"bigint unsigned": "uint64",
5 years ago
"varchar": "string",
"char": "string",
"date": "time.Time",
5 years ago
"datetime": "time.Time",
"bit(1)": "[]uint8",
"tinyint": "int8",
5 years ago
"tinyint unsigned": "uint8",
"tinyint(1)": "bool", // tinyint(1) 默认设置成bool
4 years ago
"tinyint(1) unsigned": "bool", // tinyint(1) 默认设置成bool
5 years ago
"json": "string",
5 years ago
"text": "string",
5 years ago
"timestamp": "time.Time",
5 years ago
"double": "float64",
5 years ago
"mediumtext": "string",
"longtext": "string",
"float": "float32",
4 years ago
"float unsigned": "float32",
5 years ago
"tinytext": "string",
"enum": "string",
5 years ago
"time": "time.Time",
"tinyblob": "[]byte",
"blob": "[]byte",
"mediumblob": "[]byte",
"longblob": "[]byte",
"integer": "int64",
5 years ago
}
// TypeMysqlMatchMp Fuzzy Matching Types.模糊匹配类型
var TypeMysqlMatchMp = map[string]string{
`^(tinyint)[(]\d+[)] unsigned`: "uint8",
`^(smallint)[(]\d+[)] unsigned`: "uint16",
`^(int)[(]\d+[)] unsigned`: "uint32",
`^(bigint)[(]\d+[)] unsigned`: "uint64",
4 years ago
`^(tinyint)[(]\d+[)]`: "int8",
`^(smallint)[(]\d+[)]`: "int16",
`^(int)[(]\d+[)]`: "int",
`^(bigint)[(]\d+[)]`: "int64",
`^(char)[(]\d+[)]`: "string",
`^(enum)[(](.)+[)]`: "string",
`^(varchar)[(]\d+[)]`: "string",
`^(varbinary)[(]\d+[)]`: "[]byte",
`^(blob)[(]\d+[)]`: "[]byte",
`^(binary)[(]\d+[)]`: "[]byte",
`^(decimal)[(]\d+,\d+[)]`: "float64",
`^(mediumint)[(]\d+[)]`: "string",
`^(double)[(]\d+,\d+[)]`: "float64",
`^(float)[(]\d+,\d+[)]`: "float64",
`^(float)[(]\d+,\d+[)] unsigned`: "float64",
`^(datetime)[(]\d+[)]`: "time.Time",
4 years ago
`^(bit)[(]\d+[)]`: "[]uint8",
`^(text)[(]\d+[)]`: "string",
`^(integer)[(]\d+[)]`: "int",
6 years ago
}