type Namer interface { TableName(table string) string SchemaName(table string) string ColumnName(table, column string) string JoinTableName(table string) string RelationshipFKName(Relationship) string CheckerName(table, column string) string IndexName(table, column string) string }
|
默认
NamingStrategy
也提供了几个选项,如:
db, err := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{ NamingStrategy: schema.NamingStrategy{ TablePrefix: "t_", SingularTable: true, NoLowerCase: true, NameReplacer: strings.NewReplacer("CID", "Cid"), }, })
|