SingularTable for JoinTable

This commit is contained in:
Jinzhu 2020-06-30 07:29:15 +08:00
parent 9bfe306975
commit 2d048d9ece
1 changed files with 3 additions and 0 deletions

View File

@ -41,6 +41,9 @@ func (ns NamingStrategy) ColumnName(table, column string) string {
// JoinTableName convert string to join table name // JoinTableName convert string to join table name
func (ns NamingStrategy) JoinTableName(str string) string { func (ns NamingStrategy) JoinTableName(str string) string {
if ns.SingularTable {
return ns.TablePrefix + toDBName(str)
}
return ns.TablePrefix + inflection.Plural(toDBName(str)) return ns.TablePrefix + inflection.Plural(toDBName(str))
} }