You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.
xorm的命令行工具默认将decimal(8,2)做为string,因大量的转型及运算
所以在项目中使用了https://github.com/shopspring/decimal
在model中使用如下
Charge decimal.Decimal
json:"charge" xorm:"not null DECIMAL(8,2)"
可以顺利插入至数据库,但取值时出现问题
例如
方法中使用has, err := db.Orm.Where("usid = ?", usid).Get(&charge) 查询,
但生成的sql 为
SELECT
usid
,charge
,expiretime
,type
,status
,remark
FROMcharge
WHERE (usid = ? and charge = ? ) LIMIT 1 []interface {}{198,0}多了一个charge = ? 的查询条件
如果改回string则一切正常。
The text was updated successfully, but these errors were encountered: