unsigned int column has incorrect type and tag #29

Closed
opened 2021-06-15 02:31:12 +00:00 by weakptr · 3 comments
Contributor

what I expected:

	ID          uint32 `xorm:"'id' not null pk autoincr INT(10)"`

what I got:

	ID          string `xorm:"'id' not null pk autoincr UNSIGNED INT(10)"`

xorm 不支持 unsigned int 姑且不提,reverse 逆向出来的结果避开 unsigned 的tag,给正确的 uint 类型应该是可以的。

比较担心的是数据库实际类型是 unsigned int,但 xorm tag 只写了 INT ,Go 类型又是 uint32 会不会导致反序列化结果出问题。

what I expected: ```golang ID uint32 `xorm:"'id' not null pk autoincr INT(10)"` ``` what I got: ```golang ID string `xorm:"'id' not null pk autoincr UNSIGNED INT(10)"` ``` xorm 不支持 unsigned int 姑且不提,reverse 逆向出来的结果避开 unsigned 的tag,给正确的 uint 类型应该是可以的。 比较担心的是数据库实际类型是 unsigned int,但 xorm tag 只写了 INT ,Go 类型又是 uint32 会不会导致反序列化结果出问题。
Owner

convert unsigned int to string is safe. But we actually should use uint32.

convert `unsigned int` to `string` is safe. But we actually should use `uint32`.
lunny added the
bug
label 2021-06-15 10:02:12 +00:00

同样问题 +1

同样问题 +1
Owner

#31 should fix the problem.

https://gitea.com/xorm/reverse/pulls/31 should fix the problem.
lunny closed this issue 2021-09-07 05:43:19 +00:00
lunny referenced this issue from a commit 2021-09-07 05:43:20 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
3 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/reverse#29
No description provided.