xorm
xorm copied to clipboard
能加入 Decimal 类型的支持吗?
不要把 Decimal 类型转给 Go string 类型,能转成这个包 math/big 类型吗?
@lunny 目前还是转换成string类型啊,我手动改成float64... 比如说以下字段Balance
和 TradeCredit
都是decimal类型,Balance是DECIMAL(14,2),TradeCredit是DECIMAL(5,2),都转换成string类型了。执行sql的时候会报错,我需要手动改成float64
type User struct {
Id int `xorm:"not null pk autoincr comment('用户id') INT(11)"`
Username string `xorm:"not null default '' comment('用户名') unique CHAR(100)"`
PhoneNo string `xorm:"not null default '' comment('用户手机') unique CHAR(11)"`
Password string `xorm:"not null default '' comment('用户密码') VARCHAR(100)"`
Balance string `xorm:"not null default 0.00 comment('用户余额') DECIMAL(14,2)"`
TradeCredit string `xorm:"not null default 0.00 comment('交易信用分') DECIMAL(5,2)"`
CreateAt time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('插入时间') TIMESTAMP"`
UpdateTs time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"`
}
我去 两年了 decimal还是string