support custom fuzzy regular matching

支持模糊匹配自定义类型
master
rellopn 2 years ago
parent ba9821f5be
commit 66a8154250

@ -32,6 +32,7 @@ db_info:
self_type_define: # 自定义数据类型映射 self_type_define: # 自定义数据类型映射
datetime: time.Time datetime: time.Time
time: time.Time time: time.Time
^(int)[(]\d+[)]: int
out_file_name: "" # 自定义生成文件名 out_file_name: "" # 自定义生成文件名
web_tag_type: 0 # json tag类型 0: 小驼峰 1: 下划线 web_tag_type: 0 # json tag类型 0: 小驼峰 1: 下划线

@ -73,6 +73,13 @@ func getTypeName(name string, isNull bool) string {
return fixNullToPorint(v, isNull) 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.先精确匹配 // Precise matching first.先精确匹配
if v, ok := cnf.TypeMysqlDicMp[name]; ok { if v, ok := cnf.TypeMysqlDicMp[name]; ok {
return fixNullToPorint(v, isNull) return fixNullToPorint(v, isNull)

Loading…
Cancel
Save