自定义主键Id()的调用 #51

Closed
opened 2014-01-15 11:05:30 +00:00 by Ehuos · 0 comments
Ehuos commented 2014-01-15 11:05:30 +00:00 (Migrated from github.com)

在表未定义主键之前这个代码是会通过id去更新数据的
eft, err := db.Id(id).Update(a)

在自定义主键后表结构如下
type Article struct {
Id int32 pk INT autoincr
Name string xorm:"VARCHAR(45)"
Img string xorm:"VARCHAR(100)"
Aside string XORM:"VARCHAR(200)"
Desc string XORM:"VARCHAR(200)"
Content string XORM:"TEXT"
Status int8 xorm:"TINYINT(4)"
}

eft, err := db.Id(id).Update(a)中Id(id)是无效的

在表未定义主键之前这个代码是会通过id去更新数据的 eft, err := db.Id(id).Update(a) 在自定义主键后表结构如下 type Article struct { Id int32 `pk INT autoincr` Name string `xorm:"VARCHAR(45)"` Img string `xorm:"VARCHAR(100)"` Aside string `XORM:"VARCHAR(200)"` Desc string `XORM:"VARCHAR(200)"` Content string `XORM:"TEXT"` Status int8 `xorm:"TINYINT(4)"` } eft, err := db.Id(id).Update(a)中Id(id)是无效的
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#51
No description provided.