feature model fix (#296)

* add raw stirng quote for sql field

* remove unused code
This commit is contained in:
anqiansong
2020-12-21 09:43:32 +08:00
committed by GitHub
parent 097f6886f2
commit a3b525b50d
21 changed files with 1127 additions and 59 deletions

View File

@@ -21,9 +21,6 @@ import (
const (
pwd = "."
createTableFlag = `(?m)^(?i)CREATE\s+TABLE` // ignore case
NamingLower = "lower"
NamingCamel = "camel"
NamingSnake = "snake"
)
type (
@@ -280,3 +277,20 @@ func (g *defaultGenerator) genModel(in parser.Table, withCache bool) (string, er
return output.String(), nil
}
func wrapWithRawString(v string) string {
if v == "`" {
return v
}
if !strings.HasPrefix(v, "`") {
v = "`" + v
}
if !strings.HasSuffix(v, "`") {
v = v + "`"
} else if len(v) == 1 {
v = v + "`"
}
return v
}