1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-12 07:51:08 -04:00

Remove duplicate *Tx versions of database access methods

Simplify naming to remove "Tx" now that all handlers only have access to
transactions anyway, and always use "tx" as the name of the variable
representing the SQL transactions (to make it less likely to cause
confusion with monetary transactions).
This commit is contained in:
2017-10-14 19:41:13 -04:00
parent 4e53a5e59c
commit 2ff1f47432
8 changed files with 67 additions and 147 deletions

View File

@ -37,7 +37,7 @@ func ofxImportHelper(tx *Tx, r io.Reader, user *User, accountid int64) ResponseW
}
// Return Account with this Id
account, err := GetAccountTx(tx, accountid, user.UserId)
account, err := GetAccount(tx, accountid, user.UserId)
if err != nil {
log.Print(err)
return NewError(3 /*Invalid Request*/)
@ -117,7 +117,7 @@ func ofxImportHelper(tx *Tx, r io.Reader, user *User, accountid int64) ResponseW
SecurityId: sec.SecurityId,
Type: account.Type,
}
subaccount, err := GetCreateAccountTx(tx, *subaccount)
subaccount, err := GetCreateAccount(tx, *subaccount)
if err != nil {
log.Print(err)
return NewError(999 /*Internal Error*/)
@ -137,7 +137,7 @@ func ofxImportHelper(tx *Tx, r io.Reader, user *User, accountid int64) ResponseW
}
}
imbalances, err := transaction.GetImbalancesTx(tx)
imbalances, err := transaction.GetImbalances(tx)
if err != nil {
log.Print(err)
return NewError(999 /*Internal Error*/)
@ -157,7 +157,7 @@ func ofxImportHelper(tx *Tx, r io.Reader, user *User, accountid int64) ResponseW
split := new(Split)
r := new(big.Rat)
r.Neg(&imbalance)
security, err := GetSecurityTx(tx, imbalanced_security, user.UserId)
security, err := GetSecurity(tx, imbalanced_security, user.UserId)
if err != nil {
log.Print(err)
return NewError(999 /*Internal Error*/)
@ -185,7 +185,7 @@ func ofxImportHelper(tx *Tx, r io.Reader, user *User, accountid int64) ResponseW
split.SecurityId = -1
}
exists, err := split.AlreadyImportedTx(tx)
exists, err := split.AlreadyImported(tx)
if err != nil {
log.Print("Error checking if split was already imported:", err)
return NewError(999 /*Internal Error*/)
@ -200,7 +200,7 @@ func ofxImportHelper(tx *Tx, r io.Reader, user *User, accountid int64) ResponseW
}
for _, transaction := range transactions {
err := InsertTransactionTx(tx, &transaction, user)
err := InsertTransaction(tx, &transaction, user)
if err != nil {
log.Print(err)
return NewError(999 /*Internal Error*/)