diff --git a/util/string.go b/util/string.go index 3d1074a..03c8473 100644 --- a/util/string.go +++ b/util/string.go @@ -71,6 +71,11 @@ func SnakeCaseToCamel(str string) string { continue } } + // 将ID转为大写 + if str[i] == 'd' && i-1 >= 0 && (str[i-1] == 'i' || str[i-1] == 'I') && (i+1 == len(str) || i+1 < len(str) && str[i+1] == '_') { + builder.WriteByte('d' - ('a' - 'A')) + continue + } builder.WriteByte(str[i]) } return builder.String()