naise_pos/db/sqlc/stock_log.sql.go
2023-03-19 18:17:17 +07:00

77 lines
1.9 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.17.2
// source: stock_log.sql
package db
import (
"context"
"github.com/google/uuid"
)
const createStockLogs = `-- name: CreateStockLogs :one
INSERT INTO stock_logs (
product_id,
merchant_id,
created_by,
transaction_id,
transaction_action_type,
transaction_description,
type,
selling_price,
purchase_price,
quantity
) VALUES (
$1, $2, $3, $4, $5 ,$6, $7, $8, $9, $10
)
RETURNING id, index_id, merchant_id, product_id, created_by, transaction_id, transaction_action_type, transaction_description, type, selling_price, purchase_price, quantity, created_at, updated_at
`
type CreateStockLogsParams struct {
ProductID uuid.UUID `json:"product_id"`
MerchantID uuid.UUID `json:"merchant_id"`
CreatedBy uuid.UUID `json:"created_by"`
TransactionID uuid.NullUUID `json:"transaction_id"`
TransactionActionType string `json:"transaction_action_type"`
TransactionDescription string `json:"transaction_description"`
Type StockLogsType `json:"type"`
SellingPrice float64 `json:"selling_price"`
PurchasePrice float64 `json:"purchase_price"`
Quantity float64 `json:"quantity"`
}
func (q *Queries) CreateStockLogs(ctx context.Context, arg CreateStockLogsParams) (StockLog, error) {
row := q.db.QueryRowContext(ctx, createStockLogs,
arg.ProductID,
arg.MerchantID,
arg.CreatedBy,
arg.TransactionID,
arg.TransactionActionType,
arg.TransactionDescription,
arg.Type,
arg.SellingPrice,
arg.PurchasePrice,
arg.Quantity,
)
var i StockLog
err := row.Scan(
&i.ID,
&i.IndexID,
&i.MerchantID,
&i.ProductID,
&i.CreatedBy,
&i.TransactionID,
&i.TransactionActionType,
&i.TransactionDescription,
&i.Type,
&i.SellingPrice,
&i.PurchasePrice,
&i.Quantity,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}