Regenerate sqlc

This commit is contained in:
2021-12-02 10:44:01 +00:00
parent adce350e0c
commit cdc767a497
4 changed files with 13 additions and 22 deletions

View File

@ -5,10 +5,10 @@ package postgres
import (
"context"
"database/sql"
"time"
"github.com/google/uuid"
"github.com/jackc/pgtype"
)
const createTransaction = `-- name: CreateTransaction :one
@ -20,14 +20,14 @@ RETURNING id, date, memo, amount, account_id, payee_id
type CreateTransactionParams struct {
Date time.Time
Memo sql.NullString
Amount string
Memo string
Amount pgtype.Numeric
AccountID uuid.UUID
PayeeID uuid.NullUUID
}
func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error) {
row := q.db.QueryRowContext(ctx, createTransaction,
row := q.db.QueryRow(ctx, createTransaction,
arg.Date,
arg.Memo,
arg.Amount,
@ -52,7 +52,7 @@ WHERE transactions.account_id = $1
`
func (q *Queries) GetTransactionsForAccount(ctx context.Context, accountID uuid.UUID) ([]Transaction, error) {
rows, err := q.db.QueryContext(ctx, getTransactionsForAccount, accountID)
rows, err := q.db.Query(ctx, getTransactionsForAccount, accountID)
if err != nil {
return nil, err
}
@ -72,9 +72,6 @@ func (q *Queries) GetTransactionsForAccount(ctx context.Context, accountID uuid.
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
@ -88,7 +85,7 @@ WHERE accounts.budget_id = $1
`
func (q *Queries) GetTransactionsForBudget(ctx context.Context, budgetID uuid.UUID) ([]Transaction, error) {
rows, err := q.db.QueryContext(ctx, getTransactionsForBudget, budgetID)
rows, err := q.db.Query(ctx, getTransactionsForBudget, budgetID)
if err != nil {
return nil, err
}
@ -108,9 +105,6 @@ func (q *Queries) GetTransactionsForBudget(ctx context.Context, budgetID uuid.UU
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}