Import category
This commit is contained in:
@ -12,17 +12,18 @@ import (
|
||||
|
||||
const createTransaction = `-- name: CreateTransaction :one
|
||||
INSERT INTO transactions
|
||||
(date, memo, amount, account_id, payee_id)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id, date, memo, amount, account_id, payee_id
|
||||
(date, memo, amount, account_id, payee_id, category_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
RETURNING id, date, memo, amount, account_id, category_id, payee_id
|
||||
`
|
||||
|
||||
type CreateTransactionParams struct {
|
||||
Date time.Time
|
||||
Memo string
|
||||
Amount Numeric
|
||||
AccountID uuid.UUID
|
||||
PayeeID uuid.NullUUID
|
||||
Date time.Time
|
||||
Memo string
|
||||
Amount Numeric
|
||||
AccountID uuid.UUID
|
||||
PayeeID uuid.NullUUID
|
||||
CategoryID uuid.NullUUID
|
||||
}
|
||||
|
||||
func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error) {
|
||||
@ -32,6 +33,7 @@ func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionPa
|
||||
arg.Amount,
|
||||
arg.AccountID,
|
||||
arg.PayeeID,
|
||||
arg.CategoryID,
|
||||
)
|
||||
var i Transaction
|
||||
err := row.Scan(
|
||||
@ -40,6 +42,7 @@ func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionPa
|
||||
&i.Memo,
|
||||
&i.Amount,
|
||||
&i.AccountID,
|
||||
&i.CategoryID,
|
||||
&i.PayeeID,
|
||||
)
|
||||
return i, err
|
||||
|
Reference in New Issue
Block a user