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

Closed
opened 8 years ago by Ehuos · 0 comments
Ehuos commented 8 years ago (Migrated from github.com)
Owner

在表未定义主键之前这个代码是会通过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

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.