Skip to content

Latest commit

 

History

History
19 lines (18 loc) · 523 Bytes

README.md

File metadata and controls

19 lines (18 loc) · 523 Bytes

go-generate

安装:

go get github.com/sicuni/go-generate

自动生成model、dao代码

使用说明:

        gen := go_generate.New(config.New(
		config.WithModelPath("./"), //model 代码输出路径
		config.WithDaoPath("./"),   //dao 代码输出路径
	))
	gen.UseDB(database.OpenGorm(database.MYSQL, MysqlConnectstring)) //使用gorm mysql
	gen.BindModel(gen.GenModelAs("user", "User"))             //绑定模型
	if err := gen.Execute(); err != nil {
		fmt.Println(err)
	}