26 lines
584 B
Go
26 lines
584 B
Go
package main
|
|
|
|
import (
|
|
"gorm.io/gen"
|
|
|
|
"gitea.micah.com/micah/standard/initialize"
|
|
"gitea.micah.com/micah/standard/internal/dal"
|
|
)
|
|
|
|
func main() {
|
|
g := gen.NewGenerator(gen.Config{
|
|
OutPath: "./internal/dal/query",
|
|
Mode: gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface, // generate mode
|
|
})
|
|
// 初始化
|
|
initialize.Init()
|
|
g.UseDB(dal.GetDB())
|
|
|
|
// Generate struct `User` based on table `users`
|
|
// Generate basic type-safe DAO API for struct `model.User` following conventions
|
|
g.ApplyBasic(g.GenerateModel("user"))
|
|
|
|
// Generate the code
|
|
g.Execute()
|
|
}
|