mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-02 04:18:38 -04:00
Store currency/security values/prices using big.Rat natively
This adds 'shadow' types used only by the store/db internal package whch handle converting these types to their DB-equivalent values. This change should allow reports to be generated significantly faster since it allows a large portion of the computation to be shifted to the database engines.
This commit is contained in:
@ -60,11 +60,7 @@ func luaPrice__index(L *lua.LState) int {
|
||||
}
|
||||
L.Push(SecurityToLua(L, c))
|
||||
case "Value", "value":
|
||||
amt, err := models.GetBigAmount(p.Value)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
float, _ := amt.Float64()
|
||||
float, _ := p.Value.Float64()
|
||||
L.Push(lua.LNumber(float))
|
||||
default:
|
||||
L.ArgError(2, "unexpected price attribute: "+field)
|
||||
@ -86,7 +82,7 @@ func luaPrice__tostring(L *lua.LState) int {
|
||||
panic("Price's currency or security not found for user")
|
||||
}
|
||||
|
||||
L.Push(lua.LString(p.Value + " " + c.Symbol + " (" + s.Symbol + ")"))
|
||||
L.Push(lua.LString(p.Value.String() + " " + c.Symbol + " (" + s.Symbol + ")"))
|
||||
|
||||
return 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user