39 lines
738 B
Go
39 lines
738 B
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.27.0
|
|
// source: query.sql
|
|
|
|
package ruprod
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const createProduct = `-- name: CreateProduct :one
|
|
INSERT INTO product (
|
|
name, price, purchase_date
|
|
) VALUES (
|
|
$1, $2, $3
|
|
)
|
|
RETURNING id, name, price, purchase_date
|
|
`
|
|
|
|
type CreateProductParams struct {
|
|
Name string
|
|
Price pgtype.Float8
|
|
PurchaseDate pgtype.Timestamp
|
|
}
|
|
|
|
func (q *Queries) CreateProduct(ctx context.Context, arg CreateProductParams) (Product, error) {
|
|
row := q.db.QueryRow(ctx, createProduct, arg.Name, arg.Price, arg.PurchaseDate)
|
|
var i Product
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Name,
|
|
&i.Price,
|
|
&i.PurchaseDate,
|
|
)
|
|
return i, err
|
|
}
|