官网配置:https://gorm.io/zh_CN/docs/gorm_config.html
1 2 3 4 5 6 7 8 9 10 11 12 13
| db, err := gorm.Open( sqlite.Open("gorm.db"), &gorm.Config{ NamingStrategy: schema.NamingStrategy{ TablePrefix: "t_", SingularTable: true, NoLowerCase: true, NameReplacer: strings.NewReplacer("CID", "Cid"), }, SkipDefaultTransaction: true, DryRun: true, } )
|