File tree Expand file tree Collapse file tree 4 files changed +54
-7
lines changed
cmd/gobatis-plus/customargs Expand file tree Collapse file tree 4 files changed +54
-7
lines changed Original file line number Diff line number Diff line change
1
+ # gobatis-plus
2
+
3
+
4
+ ## Usage
5
+ ```
6
+ gobatis-plus -i {YOUR_PACKAGE_DIR} -o {OUTPUT_DIR}
7
+ ```
8
+ example:
9
+ ```
10
+ gobatis-plus -i github.com/xfali/gobatis-plus/example -o tmp
11
+ ```
12
+
13
+ ## Package
14
+ 1 . Add doc.go to enable gobatis in package
15
+ ```
16
+ // gobatis:enable
17
+ package example
18
+ ```
19
+ 2 . add your code
20
+ ```
21
+ // gobatis:data
22
+ type UserDo struct {
23
+ UserId int64 `tableId:"user_id,idType=auto"`
24
+ UserName string `tableField:"user_name"`
25
+ Status int8 `tableField:"status" tableLogic:"0,delval=1"`
26
+ CreateTime time.Time `tableField:"create_time,fill=insert"`
27
+ RecVersion uint64 `tableRecVer:"rec_var"`
28
+ }
29
+
30
+ // gobatis:mapper
31
+ type UserMapper interface {
32
+ // gobatis:select="select * from "
33
+
34
+ Insert(vo ...UserDo) (err error)
35
+ }
36
+ ```
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ type gobatisArgs struct {
18
18
func NewDefault () (* args.GeneratorArgs , * gobatisArgs ) {
19
19
args := args .Default ().WithoutDefaultFlagParsing ()
20
20
cusArgs := & gobatisArgs {
21
- Prefix : "gobatis" ,
21
+ Prefix : "+ gobatis: " ,
22
22
}
23
23
args .CustomArgs = cusArgs
24
24
args .OutputFileBaseName = "zz_generated"
Original file line number Diff line number Diff line change
1
+ // +gobatis:enable
2
+ package example
Original file line number Diff line number Diff line change 5
5
6
6
package example
7
7
8
- // gobatis:enable
9
- type TestDo struct {
8
+ import "time"
10
9
10
+ // +gobatis:data
11
+ type UserDo struct {
12
+ //
13
+ UserId int64 `tableId:"user_id,idType=auto"`
14
+ UserName string `tableField:"user_name"`
15
+ Status int8 `tableField:"status" tableLogic:"0,delval=1"`
16
+ CreateTime time.Time `tableField:"create_time,fill=insert"`
17
+ RecVersion uint64 `tableRecVer:"rec_var"`
11
18
}
12
19
13
- // gobatis:mapper
14
- type TestMapper interface {
15
- Insert ()
16
- }
20
+ // +gobatis:mapper
21
+ type UserMapper interface {
22
+ // +gobatis:select="select * from "
23
+
24
+ Insert (vo ... UserDo ) (err error )
25
+ }
You can’t perform that action at this time.
0 commit comments