数据库的值是null的时候 只获取某列会报错 #889

Closed
opened 2018-04-11 13:48:41 +00:00 by Geew · 0 comments
Geew commented 2018-04-11 13:48:41 +00:00 (Migrated from github.com)

写法
var name string has, err := engine.Where("id = ?", id).Cols("name").Get(&name) 数据库的name值是NULL
报错信息如下:
sql: Scan error on column index 0: unsupported Scan, storing driver.Value type <nil> into type *string

写法 `var name string has, err := engine.Where("id = ?", id).Cols("name").Get(&name) 数据库的name值是NULL ` 报错信息如下: `sql: Scan error on column index 0: unsupported Scan, storing driver.Value type <nil> into type *string `
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#889
No description provided.