golang gorp select with nullString失败

时间:2015-08-08 04:40:06

标签: select go nullable gorp

我定义了像t

这样的订单结构
type Order struct {
    Id      nullString `db:"O_ID"`
    CusTel  int64      `db:"O_CUS_TEL"`
}

当我打电话时,我按顺序安装了Order对象:dbmap.SelectInt("SELECT count(*) FROM ORDERS WHERE O_ID=?",o.Id) 我有这样的错误:

[gorp] SELECT count(*) FROM ORDERS WHERE O_ID=? []
Search order by id:{{00000001 true}} fail:Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1

但如果我这样使用它:

dbmap.Db.Exec("SELECT count(*) FROM ORDERS WHERE O_ID=?",o.Id)

它完成了。

我不知道为什么?

0 个答案:

没有答案