naise_pos/db/sqlc/purchase_order.sql.go
2023-03-05 23:35:41 +07:00

66 lines
1.3 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.17.2
// source: purchase_order.sql
package db
import (
"context"
"database/sql"
"github.com/google/uuid"
)
const createPurchaseOrder = `-- name: CreatePurchaseOrder :one
INSERT INTO purchase_order (
merchant_id,
supplier_id,
code,
is_paid,
total,
paid_nominal,
note
) VALUES (
$1, $2, $3, $4, $5, $6, $7
)
RETURNING id, supplier_id, merchant_id, index_id, code, is_paid, total, paid_nominal, note, created_at, updated_at
`
type CreatePurchaseOrderParams struct {
MerchantID uuid.UUID `json:"merchant_id"`
SupplierID uuid.UUID `json:"supplier_id"`
Code sql.NullString `json:"code"`
IsPaid bool `json:"is_paid"`
Total float64 `json:"total"`
PaidNominal float64 `json:"paid_nominal"`
Note sql.NullString `json:"note"`
}
func (q *Queries) CreatePurchaseOrder(ctx context.Context, arg CreatePurchaseOrderParams) (PurchaseOrder, error) {
row := q.db.QueryRowContext(ctx, createPurchaseOrder,
arg.MerchantID,
arg.SupplierID,
arg.Code,
arg.IsPaid,
arg.Total,
arg.PaidNominal,
arg.Note,
)
var i PurchaseOrder
err := row.Scan(
&i.ID,
&i.SupplierID,
&i.MerchantID,
&i.IndexID,
&i.Code,
&i.IsPaid,
&i.Total,
&i.PaidNominal,
&i.Note,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}