1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 20:28:38 -04:00

Use SQL transactions for the entirety of every request

This commit is contained in:
2017-10-14 14:20:50 -04:00
parent 6726d9cb2f
commit 4e53a5e59c
14 changed files with 496 additions and 989 deletions

View File

@ -91,23 +91,6 @@ func GetClosestPriceTx(transaction *gorp.Transaction, security, currency *Securi
}
}
func GetClosestPrice(db *DB, security, currency *Security, date *time.Time) (*Price, error) {
transaction, err := db.Begin()
if err != nil {
return nil, err
}
price, err := GetClosestPriceTx(transaction, security, currency, date)
if err != nil {
transaction.Rollback()
return nil, err
}
err = transaction.Commit()
if err != nil {
transaction.Rollback()
return nil, err
}
return price, nil
func GetClosestPrice(tx *Tx, security, currency *Security, date *time.Time) (*Price, error) {
return GetClosestPriceTx(tx, security, currency, date)
}