1. 首页
  2. 主题
  3. Go问与答

go 如何 接收 mysql decimal 类型的值

zhhzone · · 3532 次点击
报错 Scan error on column index 4, name "money": converting driver.Value type []uint8 ("0.100") to a int: invalid syntax ``` type Order struct{ Money float32 `"db:money"` } var order Order rows, err = DB.Query("select money from order where id =1") rows.Scan(&order.Money) ```
遇事不决 先 string
#3
更多评论
可以试试这个[shopspring/decimal](https://github.com/shopspring/decimal)
#1
遇事不决先读string再处理吧 数字型记得是小数位置自定义的,没标准类型的。
#2

用户登录

没有账号?注册

今日阅读排行

    加载中

一周阅读排行

    加载中