package main

import (
	"Crimson-Gatekeeper/internal/common"
	"fmt"

	"gorm.io/gen"
)

func main() {
	client, clean := common.GetDataBaseClient()
	defer func() {
		err := clean()
		if err != nil {
			fmt.Println("关闭数据库链接失败")
		}
	}()
	g := gen.NewGenerator(gen.Config{
		OutPath:       "./internal/query",
		ModelPkgPath:  "./internal/model",
		Mode:          gen.WithDefaultQuery,
		FieldNullable: true,
	})
	g.UseDB(client)
	g.ApplyBasic(g.GenerateAllTable()...)
	g.Execute()
}
