Empowering Native Language Programming, Simplifying GORM Tag Generation
gormmom
is a tool designed to automatically generate GORM tags, aimed at helping developers program in their native language while simplifying the process of defining GORM tags. The tool processes struct fields and automatically generates GORM-compliant tags, ensuring field names follow specific naming conventions.
- Automatic GORM Tag Generation: Automatically generates GORM tags for struct fields, such as
column
,index
,unique
, etc. - Native Language Programming Support: Allows developers to define struct fields in their native language (e.g., Chinese), reducing the difficulty of understanding business.
go get github.com/yyle88/gormmom
type Example struct {
V证号 string `gorm:"primaryKey"`
V姓名 string `gorm:"index"`
V年龄 int `gorm:"unique"`
V性别 bool `gorm:"column:sex;uniqueIndex" mom:"naming:S63"`
}
type Example struct {
V证号 string `gorm:"column:v_c18b_f753;primaryKey" mom:"naming:s63;"`
V姓名 string `gorm:"column:v_d359_0d54;index:idx_example_v_d359_0d54" mom:"naming:s63;idx:cnm;"`
V年龄 int `gorm:"column:v_745e_849f;unique" mom:"naming:s63;"`
V性别 bool `gorm:"column:V_2760_2B52;uniqueIndex:udx_example_V_2760_2B52" mom:"naming:S63;udx:cnm;"`
}
- naming: Configures the naming convention for database column names.
- idx: Configures the naming convention for single-column indexes.
- udx: Configures the naming convention for single-column unique indexes.
gormmom
is open-source and released under the MIT License. See the LICENSE file for more information.
Welcome to contribute to this project by submitting pull requests or reporting issues.
If you find this package helpful, give it a star on GitHub!
Thank you for your support!
Happy Coding with gormmom
! 🎉
Give me stars. Thank you!!!