struct中含有uint64字段且位数超过一定长度后,插入的数据不对。 #722

Closed
opened 2017-09-13 05:48:45 +00:00 by sumingde0505 · 3 comments
sumingde0505 commented 2017-09-13 05:48:45 +00:00 (Migrated from github.com)

例如:
type User struct{
ID int xorm:"'id' pk autoincr"
UserId uint64 xorm:"'userId' decimal(25,0)"
}
user:=&User{
ID:1,
UserId:13137389433644122112,
}
engine.Insert(user)
在数据库中的userId为-5309354640065429504

查找原因,发现在session_convert.go#658中
return int64(fieldValue.Uint()), nil 不合理。
不能将uint64强转为int64.

例如: type User struct{ ID int `xorm:"'id' pk autoincr"` UserId uint64 `xorm:"'userId' decimal(25,0)"` } user:=&User{ ID:1, UserId:13137389433644122112, } engine.Insert(user) 在数据库中的userId为-5309354640065429504 查找原因,发现在session_convert.go#658中 return int64(fieldValue.Uint()), nil 不合理。 不能将uint64强转为int64.

目前没有支持uint

目前没有支持uint
menduo commented 2018-12-02 08:29:06 +00:00 (Migrated from github.com)

@lunny 请问,好像现在还是不支持是吗?

@lunny 请问,好像现在还是不支持是吗?

对,目前还没有支持。

对,目前还没有支持。
lunny added this to the 1.1.1 milestone 2020-03-13 09:31:39 +00:00
lunny modified the milestone from 1.1.1 to 1.2.0 2021-06-08 12:20:13 +00:00
lunny modified the milestone from 1.2.0 to 1.1.1 2021-06-12 05:28:11 +00:00
lunny closed this issue 2021-06-12 05:28:19 +00:00
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#722
No description provided.