Still migrating to postgres, have to check that everything works and fix stuff

This commit is contained in:
2025-09-02 23:50:19 +01:00
parent 6c5922bb5e
commit 4552b8c969
64 changed files with 1196 additions and 1279 deletions
+9 -5
View File
@@ -1,20 +1,24 @@
package expenses
import (
"context"
mod "expenses/expenses/models"
"github.com/jackc/pgx/v5"
)
func (a *ExpensesApp) GetAllUsers() ([]mod.User, error) {
tx, err := a.DB.Begin()
ctx := context.Background()
tx, err := a.DB.BeginTx(ctx, pgx.TxOptions{})
if err != nil {
return []mod.User{}, err
}
defer tx.Rollback()
defer tx.Rollback(ctx)
users, err := mod.GetAllUsers(tx)
users, err := mod.GetAllUsers(a.DB, tx)
if err != nil {
return []mod.User{}, err
}
return users, tx.Commit()
return users, tx.Commit(ctx)
}