From 75475dfa6f84cedc2b82890c91d86f855591ce50 Mon Sep 17 00:00:00 2001 From: lubin Date: Tue, 22 Sep 2020 12:01:31 +0800 Subject: [PATCH] fix bug for tinyint(8) unsigned When I used this tool to generate files, I found that even if the table structure did not change, the generated files would change. After debugging. Finding the configuration here will cause the program to find two keys randomly. The original code might have tinyint (8) unsigned randomly match int8 or Unit8. Put the unsigned one to the front, and then test it. This problem will not happen again. --- data/view/cnf/def.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/view/cnf/def.go b/data/view/cnf/def.go index e87a203..91949aa 100644 --- a/data/view/cnf/def.go +++ b/data/view/cnf/def.go @@ -42,10 +42,15 @@ var TypeMysqlDicMp = map[string]string{ "longblob": "[]byte", } +// TypeMysqlMatchMp Fuzzy Matching Types.模糊匹配类型 + // TypeMysqlMatchMp Fuzzy Matching Types.模糊匹配类型 var TypeMysqlMatchMp = map[string]string{ - `^(tinyint)[(]\d+[)]`: "int8", `^(tinyint)[(]\d+[)] unsigned`: "uint8", + `^(smallint)[(]\d+[)] unsigned`: "uint16", + `^(int)[(]\d+[)] unsigned`: "uint32", + `^(bigint)[(]\d+[)] unsigned`: "uint64", + `^(tinyint)[(]\d+[)]`: "int8", `^(smallint)[(]\d+[)]`: "int16", `^(int)[(]\d+[)]`: "int", `^(bigint)[(]\d+[)]`: "int64",