diff --git a/gen.go b/gen.go new file mode 100644 index 00000000..6ef3c75a --- /dev/null +++ b/gen.go @@ -0,0 +1,16 @@ +package main + +import "gorm.io/gen" + +func generate() { + g := gen.NewGenerator(gen.Config{ + OutPath: "./query", + Mode: gen.WithDefaultQuery, /*WithQueryInterface, WithoutContext*/ + }) + + g.UseDB(DB) + + g.ApplyBasic(g.GenerateModel("people"), g.GenerateModelAs("temp_user", "User")) + + g.Execute() +} diff --git a/go.mod b/go.mod index 78baff45..84a0a859 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,11 @@ module gorm.io/playground go 1.16 require ( - github.com/denisenkom/go-mssqldb v0.12.2 // indirect - github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect gorm.io/driver/mysql v1.4.1 gorm.io/driver/postgres v1.4.4 gorm.io/driver/sqlite v1.4.2 gorm.io/driver/sqlserver v1.4.1 + gorm.io/gen v0.3.21 gorm.io/gorm v1.24.0 )