78 lines
1.6 KiB
Go
78 lines
1.6 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.17.2
|
|
// source: sale_order.sql
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const createSaleOrder = `-- name: CreateSaleOrder :one
|
|
INSERT INTO sale_order (
|
|
merchant_id,
|
|
customer_id,
|
|
code,
|
|
created_by,
|
|
is_paid,
|
|
total,
|
|
paid_nominal,
|
|
note,
|
|
change,
|
|
is_keep
|
|
) VALUES (
|
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10
|
|
)
|
|
RETURNING id, index_id, code, created_by, merchant_id, customer_id, is_paid, total, paid_nominal, note, created_at, updated_at, is_keep, change
|
|
`
|
|
|
|
type CreateSaleOrderParams struct {
|
|
MerchantID uuid.UUID `json:"merchant_id"`
|
|
CustomerID uuid.NullUUID `json:"customer_id"`
|
|
Code string `json:"code"`
|
|
CreatedBy uuid.UUID `json:"created_by"`
|
|
IsPaid bool `json:"is_paid"`
|
|
Total float64 `json:"total"`
|
|
PaidNominal float64 `json:"paid_nominal"`
|
|
Note sql.NullString `json:"note"`
|
|
Change float64 `json:"change"`
|
|
IsKeep bool `json:"is_keep"`
|
|
}
|
|
|
|
func (q *Queries) CreateSaleOrder(ctx context.Context, arg CreateSaleOrderParams) (SaleOrder, error) {
|
|
row := q.db.QueryRowContext(ctx, createSaleOrder,
|
|
arg.MerchantID,
|
|
arg.CustomerID,
|
|
arg.Code,
|
|
arg.CreatedBy,
|
|
arg.IsPaid,
|
|
arg.Total,
|
|
arg.PaidNominal,
|
|
arg.Note,
|
|
arg.Change,
|
|
arg.IsKeep,
|
|
)
|
|
var i SaleOrder
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.IndexID,
|
|
&i.Code,
|
|
&i.CreatedBy,
|
|
&i.MerchantID,
|
|
&i.CustomerID,
|
|
&i.IsPaid,
|
|
&i.Total,
|
|
&i.PaidNominal,
|
|
&i.Note,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.IsKeep,
|
|
&i.Change,
|
|
)
|
|
return i, err
|
|
}
|