Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec7e823

Browse files
author
xuxinhua
committed
persist bugfix
1 parent e5e6ec8 commit ec7e823

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

websites/code/studygolang/src/model/dao.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func genPersistParams(entity interface{}) (string, []interface{}, error) {
337337
if pk == "1" {
338338
where = append(where, "`"+tag+"`"+"=?")
339339
} else {
340-
set = append(set, "`"+tag+"`"+"=?")
340+
set = append(set, "`"+tags[0]+"`"+"=?")
341341
}
342342
}
343343

websites/code/studygolang/src/model/resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ const (
1818

1919
// 资源信息
2020
type Resource struct {
21-
Id int `json:"id"`
21+
Id int `json:"id" pk:"1"`
2222
Title string `json:"title"`
2323
Form string `json:"form"`
2424
Content string `json:"content"`
2525
Url string `json:"url"`
2626
Uid int `json:"uid"`
2727
Catid int `json:"catid"`
28-
Ctime string `json:"ctime"`
29-
Mtime string `json:"mtime"`
28+
Ctime string `json:"ctime,omitempty"`
29+
Mtime string `json:"mtime,omitempty"`
3030

3131
// 数据库访问对象
3232
*Dao

0 commit comments

Comments
 (0)