mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-13 08:01:08 -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:
@ -6,6 +6,17 @@ import (
|
||||
"github.com/aclindsa/moneygo/internal/store"
|
||||
)
|
||||
|
||||
// MaxPrexision denotes the maximum valid value for models.Security.Precision.
|
||||
// This constant is used when storing amounts in securities into the database,
|
||||
// so it must not be changed without appropriately migrating the database.
|
||||
const MaxPrecision uint64 = 15
|
||||
|
||||
func init() {
|
||||
if MaxPrecision < models.MaxPrecision {
|
||||
panic("db.MaxPrecision must be >= models.MaxPrecision")
|
||||
}
|
||||
}
|
||||
|
||||
func (tx *Tx) GetSecurity(securityid int64, userid int64) (*models.Security, error) {
|
||||
var s models.Security
|
||||
|
||||
|
Reference in New Issue
Block a user