Repository navigation
Releases
Releases · SpectatorNan/gorm-zero
bump goctl support
upgrade new goctl support
- gorm-zero support
- support check sql null import
- custom gorm deleted_at key
- support gorm before create with before update hook, template example in model.tpl
source code link:
goctl-gorm-zero-support
Add Config type open db
- support set cache expire time when query db
- add mysql and pgsql config type struct
- add ConnectMysql with ConnectPgSql method open db
mysql:
db, err := gormc.ConnectMysql(c.Mysql)
if err != nil {
log.Fatal(err)
}
pgsql:
db, err := gormc.ConnectPgSql(c.PgSql)
if err != nil {
log.Fatal(err)
}
notice:
- If you need the model type to support the DeletedAt field to automatically use gorm.DeletedAt and automatically determine whether to reference database, you can use the following modified version of goctl code_link, please download the corresponding package according to the system type.
#check version modified version has gormc flag
goctl -v
goctl version 1.4.3-gormc darwin/amd64
- If you do not use gorm-zero support version, when the table contains optional fields, please manually import database/sql
Update templates to better handle caching
Full Changelog: v1.0.0...v1.0.2
version 1.0.1
Optimize cache related templates