Skip to content

Commit 0a3a03e

Browse files
committed
修改model -> Model
1 parent 4604499 commit 0a3a03e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

niu/db.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var (
1515

1616
type tableHook func(gid int64) error
1717

18-
type model struct {
18+
type Model struct {
1919
*gorm.DB
2020
}
2121

@@ -50,7 +50,7 @@ func registerTableHook(h ...tableHook) {
5050
}
5151

5252
// TableFor 大写是为了防止数据操作哪里有问题留个保底可以在zbp的项目里直接改
53-
func TableFor(gid int64, prefix string) *model {
53+
func TableFor(gid int64, prefix string) *Model {
5454
// 先执行钩子
5555
hooksMtx.RLock()
5656
for _, h := range tableHooks {
@@ -61,7 +61,7 @@ func TableFor(gid int64, prefix string) *model {
6161
hooksMtx.RUnlock()
6262

6363
tableName := fmt.Sprintf("group_%d_%s_info", gid, prefix)
64-
return &model{db.Table(tableName)}
64+
return &Model{db.Table(tableName)}
6565
}
6666

6767
func listUsers(gid int64) (users, error) {

niu/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
)
2323

2424
var (
25-
db *model
25+
db *Model
2626
globalLock sync.Mutex
2727

2828
errCancelFail = errors.New("遇到不可抗力因素,注销失败!")
@@ -84,7 +84,7 @@ func init() {
8484
panic(err)
8585
}
8686

87-
db = &model{sdb.LogMode(false)}
87+
db = &Model{sdb.LogMode(false)}
8888

8989
registerTableHook(ensureUserInfo, ensureAuctionInfo)
9090
}

0 commit comments

Comments
 (0)