naise_pos/db/sqlc/sale_order_detail.sql.go

65 lines
1.4 KiB
Go
Raw Normal View History

2023-03-22 12:06:09 +07:00
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.17.2
// source: sale_order_detail.sql
package db
import (
"context"
"github.com/google/uuid"
)
const createSaleOrderDetail = `-- name: CreateSaleOrderDetail :one
INSERT INTO sale_order_detail (
sale_order_id,
product_id,
product_name,
quantity,
sub_total,
product_price,
profit
) VALUES(
$1, $2, $3, $4, $5, $6, $7
)
RETURNING id, index_id, sale_order_id, product_id, product_name, quantity, sub_total, product_price, profit, created_at, updated_at
`
type CreateSaleOrderDetailParams struct {
SaleOrderID uuid.UUID `json:"sale_order_id"`
ProductID uuid.UUID `json:"product_id"`
ProductName string `json:"product_name"`
Quantity float64 `json:"quantity"`
SubTotal float64 `json:"sub_total"`
ProductPrice float64 `json:"product_price"`
Profit float64 `json:"profit"`
}
func (q *Queries) CreateSaleOrderDetail(ctx context.Context, arg CreateSaleOrderDetailParams) (SaleOrderDetail, error) {
row := q.db.QueryRowContext(ctx, createSaleOrderDetail,
arg.SaleOrderID,
arg.ProductID,
arg.ProductName,
arg.Quantity,
arg.SubTotal,
arg.ProductPrice,
arg.Profit,
)
var i SaleOrderDetail
err := row.Scan(
&i.ID,
&i.IndexID,
&i.SaleOrderID,
&i.ProductID,
&i.ProductName,
&i.Quantity,
&i.SubTotal,
&i.ProductPrice,
&i.Profit,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}