File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "gorm.io/gen"
5
+ "gorm.io/gen/examples/dal"
6
+ )
7
+
8
+ func generate () {
9
+ g := gen .NewGenerator (gen.Config {
10
+ OutPath : "./dal/query" ,
11
+ Mode : gen .WithDefaultQuery , /*WithQueryInterface, WithoutContext*/
12
+
13
+ WithUnitTest : true ,
14
+ })
15
+ g .UseDB (dal .DB )
16
+
17
+ g .ApplyBasic (Company {}, Language {}) // Associations
18
+ g .ApplyBasic (g .GenerateModel ("user" ), g .GenerateModelAs ("account" , "AccountInfo" ))
19
+
20
+ g .Execute ()
21
+ }
Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ module gorm.io/playground
3
3
go 1.20
4
4
5
5
require (
6
- gorm.io/driver/mysql v1.5.1
6
+ gorm.io/driver/mysql v1.5.2
7
7
gorm.io/driver/postgres v1.5.2
8
8
gorm.io/driver/sqlite v1.5.3
9
9
gorm.io/driver/sqlserver v1.5.1
10
+ gorm.io/gen v0.3.25
10
11
gorm.io/gorm v1.25.4
11
12
)
12
13
@@ -21,8 +22,14 @@ require (
21
22
github.com/jinzhu/now v1.1.5 // indirect
22
23
github.com/mattn/go-sqlite3 v1.14.17 // indirect
23
24
github.com/microsoft/go-mssqldb v1.5.0 // indirect
24
- golang.org/x/crypto v0.12.0 // indirect
25
- golang.org/x/text v0.12.0 // indirect
25
+ golang.org/x/crypto v0.14.0 // indirect
26
+ golang.org/x/mod v0.14.0 // indirect
27
+ golang.org/x/sys v0.14.0 // indirect
28
+ golang.org/x/text v0.13.0 // indirect
29
+ golang.org/x/tools v0.15.0 // indirect
30
+ gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect
31
+ gorm.io/hints v1.1.0 // indirect
32
+ gorm.io/plugin/dbresolver v1.5.0 // indirect
26
33
)
27
34
28
35
replace gorm.io/gorm => ./gorm
You can’t perform that action at this time.
0 commit comments