-
Notifications
You must be signed in to change notification settings - Fork 0
/
pricing.sql.go
54 lines (47 loc) · 1.38 KB
/
pricing.sql.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: pricing.sql
package product
import (
"context"
"github.com/shopspring/decimal"
)
const createProductPricing = `-- name: CreateProductPricing :exec
INSERT INTO product_pricing (
product_id, base_price, currency_code, discount_level, discounted_amount, is_on_sale
) VALUES (
$1, $2, $3, $4, $5, $6
)
`
func (q *Queries) CreateProductPricing(ctx context.Context, productID int64, basePrice decimal.Decimal, currencyCode string, discountLevel decimal.Decimal, discountedAmount decimal.Decimal, isOnSale bool) error {
_, err := q.db.Exec(ctx, createProductPricing,
productID,
basePrice,
currencyCode,
discountLevel,
discountedAmount,
isOnSale,
)
return err
}
const createSKUPricing = `-- name: CreateSKUPricing :one
INSERT INTO sku_pricing (
sku_id, base_price, currency_code, discount_level, discounted_amount, is_on_sale
) VALUES (
$1, $2, $3, $4, $5, $6
) RETURNING sku_id
`
func (q *Queries) CreateSKUPricing(ctx context.Context, skuID int64, basePrice decimal.Decimal, currencyCode string, discountLevel decimal.Decimal, discountedAmount decimal.Decimal, isOnSale bool) (int64, error) {
row := q.db.QueryRow(ctx, createSKUPricing,
skuID,
basePrice,
currencyCode,
discountLevel,
discountedAmount,
isOnSale,
)
var sku_id int64
err := row.Scan(&sku_id)
return sku_id, err
}