Use type instead of isAccount flag
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-02-25 22:28:22 +00:00
parent 32439e3e87
commit ae9e9d34c9
10 changed files with 54 additions and 26 deletions

View File

@ -130,7 +130,7 @@ func (q *Queries) GetAccountsWithBalance(ctx context.Context, budgetID uuid.UUID
}
const searchAccounts = `-- name: SearchAccounts :many
SELECT accounts.id, accounts.budget_id, accounts.name, true as is_account FROM accounts
SELECT accounts.id, accounts.budget_id, accounts.name, 'account' as type FROM accounts
WHERE accounts.budget_id = $1
AND accounts.name LIKE $2
ORDER BY accounts.name
@ -142,10 +142,10 @@ type SearchAccountsParams struct {
}
type SearchAccountsRow struct {
ID uuid.UUID
BudgetID uuid.UUID
Name string
IsAccount bool
ID uuid.UUID
BudgetID uuid.UUID
Name string
Type interface{}
}
func (q *Queries) SearchAccounts(ctx context.Context, arg SearchAccountsParams) ([]SearchAccountsRow, error) {
@ -161,7 +161,7 @@ func (q *Queries) SearchAccounts(ctx context.Context, arg SearchAccountsParams)
&i.ID,
&i.BudgetID,
&i.Name,
&i.IsAccount,
&i.Type,
); err != nil {
return nil, err
}