Regenerate sqlc
This commit is contained in:
parent
adce350e0c
commit
cdc767a497
@ -17,7 +17,7 @@ RETURNING id, name, last_modification
|
|||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) CreateBudget(ctx context.Context, name string) (Budget, error) {
|
func (q *Queries) CreateBudget(ctx context.Context, name string) (Budget, error) {
|
||||||
row := q.db.QueryRowContext(ctx, createBudget, name)
|
row := q.db.QueryRow(ctx, createBudget, name)
|
||||||
var i Budget
|
var i Budget
|
||||||
err := row.Scan(&i.ID, &i.Name, &i.LastModification)
|
err := row.Scan(&i.ID, &i.Name, &i.LastModification)
|
||||||
return i, err
|
return i, err
|
||||||
@ -29,7 +29,7 @@ WHERE id = $1
|
|||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetBudget(ctx context.Context, id uuid.UUID) (Budget, error) {
|
func (q *Queries) GetBudget(ctx context.Context, id uuid.UUID) (Budget, error) {
|
||||||
row := q.db.QueryRowContext(ctx, getBudget, id)
|
row := q.db.QueryRow(ctx, getBudget, id)
|
||||||
var i Budget
|
var i Budget
|
||||||
err := row.Scan(&i.ID, &i.Name, &i.LastModification)
|
err := row.Scan(&i.ID, &i.Name, &i.LastModification)
|
||||||
return i, err
|
return i, err
|
||||||
@ -42,7 +42,7 @@ WHERE user_budgets.user_id = $1
|
|||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetBudgetsForUser(ctx context.Context, userID uuid.UUID) ([]Budget, error) {
|
func (q *Queries) GetBudgetsForUser(ctx context.Context, userID uuid.UUID) ([]Budget, error) {
|
||||||
rows, err := q.db.QueryContext(ctx, getBudgetsForUser, userID)
|
rows, err := q.db.Query(ctx, getBudgetsForUser, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -55,9 +55,6 @@ func (q *Queries) GetBudgetsForUser(ctx context.Context, userID uuid.UUID) ([]Bu
|
|||||||
}
|
}
|
||||||
items = append(items, i)
|
items = append(items, i)
|
||||||
}
|
}
|
||||||
if err := rows.Close(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := rows.Err(); err != nil {
|
if err := rows.Err(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ package postgres
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"github.com/jackc/pgtype"
|
||||||
)
|
)
|
||||||
|
|
||||||
const createTransaction = `-- name: CreateTransaction :one
|
const createTransaction = `-- name: CreateTransaction :one
|
||||||
@ -20,14 +20,14 @@ RETURNING id, date, memo, amount, account_id, payee_id
|
|||||||
|
|
||||||
type CreateTransactionParams struct {
|
type CreateTransactionParams struct {
|
||||||
Date time.Time
|
Date time.Time
|
||||||
Memo sql.NullString
|
Memo string
|
||||||
Amount string
|
Amount pgtype.Numeric
|
||||||
AccountID uuid.UUID
|
AccountID uuid.UUID
|
||||||
PayeeID uuid.NullUUID
|
PayeeID uuid.NullUUID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error) {
|
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.Date,
|
||||||
arg.Memo,
|
arg.Memo,
|
||||||
arg.Amount,
|
arg.Amount,
|
||||||
@ -52,7 +52,7 @@ WHERE transactions.account_id = $1
|
|||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetTransactionsForAccount(ctx context.Context, accountID uuid.UUID) ([]Transaction, error) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -72,9 +72,6 @@ func (q *Queries) GetTransactionsForAccount(ctx context.Context, accountID uuid.
|
|||||||
}
|
}
|
||||||
items = append(items, i)
|
items = append(items, i)
|
||||||
}
|
}
|
||||||
if err := rows.Close(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := rows.Err(); err != nil {
|
if err := rows.Err(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -88,7 +85,7 @@ WHERE accounts.budget_id = $1
|
|||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetTransactionsForBudget(ctx context.Context, budgetID uuid.UUID) ([]Transaction, error) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -108,9 +105,6 @@ func (q *Queries) GetTransactionsForBudget(ctx context.Context, budgetID uuid.UU
|
|||||||
}
|
}
|
||||||
items = append(items, i)
|
items = append(items, i)
|
||||||
}
|
}
|
||||||
if err := rows.Close(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := rows.Err(); err != nil {
|
if err := rows.Err(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ type LinkBudgetToUserParams struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) LinkBudgetToUser(ctx context.Context, arg LinkBudgetToUserParams) (UserBudget, error) {
|
func (q *Queries) LinkBudgetToUser(ctx context.Context, arg LinkBudgetToUserParams) (UserBudget, error) {
|
||||||
row := q.db.QueryRowContext(ctx, linkBudgetToUser, arg.UserID, arg.BudgetID)
|
row := q.db.QueryRow(ctx, linkBudgetToUser, arg.UserID, arg.BudgetID)
|
||||||
var i UserBudget
|
var i UserBudget
|
||||||
err := row.Scan(&i.UserID, &i.BudgetID)
|
err := row.Scan(&i.UserID, &i.BudgetID)
|
||||||
return i, err
|
return i, err
|
||||||
|
@ -24,7 +24,7 @@ type CreateUserParams struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
|
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
|
||||||
row := q.db.QueryRowContext(ctx, createUser,
|
row := q.db.QueryRow(ctx, createUser,
|
||||||
arg.ID,
|
arg.ID,
|
||||||
arg.Email,
|
arg.Email,
|
||||||
arg.Name,
|
arg.Name,
|
||||||
@ -46,7 +46,7 @@ WHERE id = $1
|
|||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
||||||
row := q.db.QueryRowContext(ctx, getUser, id)
|
row := q.db.QueryRow(ctx, getUser, id)
|
||||||
var i User
|
var i User
|
||||||
err := row.Scan(
|
err := row.Scan(
|
||||||
&i.ID,
|
&i.ID,
|
||||||
@ -63,7 +63,7 @@ WHERE email = $1
|
|||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetUserByUsername(ctx context.Context, email string) (User, error) {
|
func (q *Queries) GetUserByUsername(ctx context.Context, email string) (User, error) {
|
||||||
row := q.db.QueryRowContext(ctx, getUserByUsername, email)
|
row := q.db.QueryRow(ctx, getUserByUsername, email)
|
||||||
var i User
|
var i User
|
||||||
err := row.Scan(
|
err := row.Scan(
|
||||||
&i.ID,
|
&i.ID,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user