diff --git a/config.yml b/config.yml index 4c28a57..5a36dcc 100644 --- a/config.yml +++ b/config.yml @@ -32,6 +32,7 @@ db_info: self_type_define: # 自定义数据类型映射 datetime: time.Time time: time.Time + ^(int)[(]\d+[)]: int out_file_name: "" # 自定义生成文件名 web_tag_type: 0 # json tag类型 0: 小驼峰 1: 下划线 diff --git a/data/view/model/common.go b/data/view/model/common.go index 1577638..3b36e86 100755 --- a/data/view/model/common.go +++ b/data/view/model/common.go @@ -73,6 +73,13 @@ func getTypeName(name string, isNull bool) string { return fixNullToPorint(v, isNull) } + // Fuzzy Regular Matching.模糊正则匹配自定义类型 + for selfKey, selfVal := range selfDefineTypeMqlDicMap { + if ok, _ := regexp.MatchString(selfKey, name); ok { + return fixNullToPorint(selfVal, isNull) + } + } + // Precise matching first.先精确匹配 if v, ok := cnf.TypeMysqlDicMp[name]; ok { return fixNullToPorint(v, isNull)