entc/gen: support custom Acronym (#2900)

This commit is contained in:
Weilence
2022-09-06 20:13:41 +08:00
committed by GitHub
parent 326fe42d49
commit 1e12537a35

View File

@@ -291,12 +291,20 @@ func ruleset() *inflect.Ruleset {
"TLS", "TTL", "UDP", "UI", "UID", "URI", "URL", "UTF8", "UUID", "VM",
"XML", "XMPP", "XSRF", "XSS",
} {
acronyms[w] = struct{}{}
rules.AddAcronym(w)
addAcronym(rules, w)
}
return rules
}
func addAcronym(rules *inflect.Ruleset, word string) {
acronyms[word] = struct{}{}
rules.AddAcronym(word)
}
func AddAcronym(word string) {
addAcronym(rules, word)
}
// order returns a map of sort orders.
// The key is the function name, and the value its database keyword.
func order() map[string]string {