32 lines
538 B
SQL
32 lines
538 B
SQL
-- name: GetBox :one
|
|
SELECT * FROM boxes
|
|
WHERE id = ? LIMIT 1;
|
|
|
|
-- name: ListBoxes :many
|
|
SELECT * FROM boxes
|
|
ORDER BY id DESC
|
|
LIMIT ? OFFSET ?;
|
|
|
|
-- name: ListBoxesByShipment :many
|
|
SELECT * FROM boxes
|
|
WHERE shipment_id = ?
|
|
ORDER BY id;
|
|
|
|
-- name: CreateBox :execresult
|
|
INSERT INTO boxes (
|
|
shipment_id, length, width, height, weight
|
|
) VALUES (
|
|
?, ?, ?, ?, ?
|
|
);
|
|
|
|
-- name: UpdateBox :exec
|
|
UPDATE boxes
|
|
SET length = ?,
|
|
width = ?,
|
|
height = ?,
|
|
weight = ?
|
|
WHERE id = ?;
|
|
|
|
-- name: DeleteBox :exec
|
|
DELETE FROM boxes
|
|
WHERE id = ?; |