Skip to content

Commit

Permalink
Merge pull request xxjwxc#214 from Rellopn/master
Browse files Browse the repository at this point in the history
 support custom fuzzy regular matching
  • Loading branch information
xxjwxc authored Jun 21, 2022
2 parents ba9821f + 66a8154 commit fc70045
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 下划线

Expand Down
7 changes: 7 additions & 0 deletions data/view/model/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fc70045

Please sign in to comment.