Skip to content

Commit f007b00

Browse files
committed
gobatis-cmd自动生成model操作数据库方法
1 parent 83b8a82 commit f007b00

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

test/cmd/test_table.go

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
//This file was generated by xfali/gobatis-cmd at
2-
//2020-02-20 15:03:12.9833677 +0800 CST m=+0.049373301
2+
//2020-02-20 15:55:57.3524245 +0800 CST m=+0.049892501
33

44
package test
55

6-
import "time"
6+
import (
7+
"github.com/xfali/gobatis"
8+
"time"
9+
)
710

811
type TestTable struct {
9-
//TableName gobatis.ModelName `test_table`
10-
Id int `xfield:"id"`
11-
Username string `xfield:"username"`
12-
Password string `xfield:"password"`
13-
Createtime time.Time `xfield:"createtime"`
12+
//TableName gobatis.ModelName `test_table`
13+
Id int `xfield:"id"`
14+
Username string `xfield:"username"`
15+
Password string `xfield:"password"`
16+
Createtime time.Time `xfield:"createtime"`
17+
}
18+
19+
func (m *TestTable) Select(sess *gobatis.Session) ([]TestTable, error) {
20+
return SelectTestTable(sess, *m)
21+
}
22+
23+
func (m *TestTable) Count(sess *gobatis.Session) (int64, error) {
24+
return SelectTestTableCount(sess, *m)
25+
}
26+
27+
func (m *TestTable) Insert(sess *gobatis.Session) (int64, int64, error) {
28+
return InsertTestTable(sess, *m)
29+
}
30+
31+
func (m *TestTable) Update(sess *gobatis.Session) (int64, error) {
32+
return UpdateTestTable(sess, *m)
33+
}
34+
35+
func (m *TestTable) Delete(sess *gobatis.Session) (int64, error) {
36+
return DeleteTestTable(sess, *m)
1437
}

0 commit comments

Comments
 (0)