fix HashMap is out of order
fix HashMap is out of order
This commit is contained in:
@@ -44,30 +44,33 @@ var TypeMysqlDicMp = map[string]string{
|
|||||||
"integer": "int64",
|
"integer": "int64",
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeMysqlMatchMp Fuzzy Matching Types.模糊匹配类型
|
// TypeMysqlMatchList Fuzzy Matching Types.模糊匹配类型
|
||||||
var TypeMysqlMatchMp = map[string]string{
|
var TypeMysqlMatchList = []struct {
|
||||||
`^(tinyint)[(]\d+[)] unsigned`: "uint8",
|
Key string
|
||||||
`^(smallint)[(]\d+[)] unsigned`: "uint16",
|
Value string
|
||||||
`^(int)[(]\d+[)] unsigned`: "uint32",
|
}{
|
||||||
`^(bigint)[(]\d+[)] unsigned`: "uint64",
|
{`^(tinyint)[(]\d+[)] unsigned`, "uint8"},
|
||||||
`^(tinyint)[(]\d+[)]`: "int8",
|
{`^(smallint)[(]\d+[)] unsigned`, "uint16"},
|
||||||
`^(smallint)[(]\d+[)]`: "int16",
|
{`^(int)[(]\d+[)] unsigned`, "uint32"},
|
||||||
`^(int)[(]\d+[)]`: "int",
|
{`^(bigint)[(]\d+[)] unsigned`, "uint64"},
|
||||||
`^(bigint)[(]\d+[)]`: "int64",
|
{`^(float)[(]\d+,\d+[)] unsigned`, "float64"},
|
||||||
`^(char)[(]\d+[)]`: "string",
|
{`^(double)[(]\d+,\d+[)] unsigned`, "float64"},
|
||||||
`^(enum)[(](.)+[)]`: "string",
|
{`^(tinyint)[(]\d+[)]`, "int8"},
|
||||||
`^(varchar)[(]\d+[)]`: "string",
|
{`^(smallint)[(]\d+[)]`, "int16"},
|
||||||
`^(varbinary)[(]\d+[)]`: "[]byte",
|
{`^(int)[(]\d+[)]`, "int"},
|
||||||
`^(blob)[(]\d+[)]`: "[]byte",
|
{`^(bigint)[(]\d+[)]`, "int64"},
|
||||||
`^(binary)[(]\d+[)]`: "[]byte",
|
{`^(char)[(]\d+[)]`, "string"},
|
||||||
`^(decimal)[(]\d+,\d+[)]`: "float64",
|
{`^(enum)[(](.)+[)]`, "string"},
|
||||||
`^(mediumint)[(]\d+[)]`: "string",
|
{`^(varchar)[(]\d+[)]`, "string"},
|
||||||
`^(double)[(]\d+,\d+[)]`: "float64",
|
{`^(varbinary)[(]\d+[)]`, "[]byte"},
|
||||||
`^(double)[(]\d+,\d+[)] unsigned`: "float64",
|
{`^(blob)[(]\d+[)]`, "[]byte"},
|
||||||
`^(float)[(]\d+,\d+[)]`: "float64",
|
{`^(binary)[(]\d+[)]`, "[]byte"},
|
||||||
`^(float)[(]\d+,\d+[)] unsigned`: "float64",
|
{`^(decimal)[(]\d+,\d+[)]`, "float64"},
|
||||||
`^(datetime)[(]\d+[)]`: "time.Time",
|
{`^(mediumint)[(]\d+[)]`, "string"},
|
||||||
`^(bit)[(]\d+[)]`: "[]uint8",
|
{`^(double)[(]\d+,\d+[)]`, "float64"},
|
||||||
`^(text)[(]\d+[)]`: "string",
|
{`^(float)[(]\d+,\d+[)]`, "float64"},
|
||||||
`^(integer)[(]\d+[)]`: "int",
|
{`^(datetime)[(]\d+[)]`, "time.Time"},
|
||||||
|
{`^(bit)[(]\d+[)]`, "[]uint8"},
|
||||||
|
{`^(text)[(]\d+[)]`, "string"},
|
||||||
|
{`^(integer)[(]\d+[)]`, "int"},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ func getTypeName(name string, isNull bool) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fuzzy Regular Matching.模糊正则匹配
|
// Fuzzy Regular Matching.模糊正则匹配
|
||||||
for k, v := range cnf.TypeMysqlMatchMp {
|
for _, l := range cnf.TypeMysqlMatchList {
|
||||||
if ok, _ := regexp.MatchString(k, name); ok {
|
if ok, _ := regexp.MatchString(l.Key, name); ok {
|
||||||
return fixNullToPorint(v, isNull)
|
return fixNullToPorint(l.Value, isNull)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user