chore: migrate to gitea
Some checks failed
golangci-lint / lint (push) Successful in 1m33s
Test / test (push) Failing after 2m16s

This commit is contained in:
2026-01-27 00:12:32 +01:00
parent 79d9f55fdc
commit f81c902ca6
3170 changed files with 1216494 additions and 1586 deletions

View File

@@ -1,11 +1,14 @@
package account
import (
"budget/internal/storage/dao"
"budget/internal/storage/dao/postgresql"
"budget/internal/utils"
"database/sql"
"errors"
"fmt"
"gitea.frenchtouch.duckdns.org/kratisto/budget-backend/internal/storage/dao"
"gitea.frenchtouch.duckdns.org/kratisto/budget-backend/internal/storage/dao/postgresql"
"gitea.frenchtouch.duckdns.org/kratisto/budget-backend/internal/utils"
"github.com/lib/pq"
)
@@ -23,7 +26,12 @@ func (db *Database) GetAllAccountOfUser(id string) ([]*Account, error) {
if err != nil {
return nil, err
}
defer rows.Close()
defer func(rows *sql.Rows) {
err := rows.Close()
if err != nil {
return
}
}(rows)
as := make([]*Account, 0)
for rows.Next() {
@@ -45,15 +53,22 @@ func (db *Database) GetAccountWithNameForUser(name string, id string) (*Account,
AND a.name = $2
`
row, err := db.Session.Query(q, id, name)
if err != nil {
return nil, err
}
if !row.Next() {
return nil, dao.NewDAOError(dao.ErrTypeNotFound, fmt.Errorf("No row found"))
return nil, dao.NewDAOError(dao.ErrTypeNotFound, fmt.Errorf("no row found"))
}
a := Account{}
row.Scan(&a.ID, &a.UserId, &a.Name, &a.Provider, &a.CreatedAt, &a.UpdatedAt)
err = row.Scan(&a.ID, &a.UserId, &a.Name, &a.Provider, &a.CreatedAt, &a.UpdatedAt)
if err != nil {
return nil, err
}
if row.Next() {
return nil, fmt.Errorf("Impossibru")
}
if errPq, ok := err.(*pq.Error); ok {
var errPq *pq.Error
if errors.As(err, &errPq) {
return nil, postgresql.HandlePgError(errPq)
}
if err != nil {