This commit is contained in:
2023-08-07 10:14:38 -04:00
parent a30b1769b3
commit 5dd3fa9451
18 changed files with 548 additions and 276 deletions

21
sql/query.sql Normal file
View File

@@ -0,0 +1,21 @@
-- name: GetGunById :one
SELECT guns.id as id, make, model, serial_number, purchase_amount, value_amount, date_purchased, notes
from guns
where guns.id = ?;
-- name: GetGunPhotos :many
SELECT id, filename from photos where gun_id = ?;
-- name: GetGunPhotoData :one
select photo from photos where id = ?;
-- name: GetAllGuns :many
SELECT id, make, model, value_amount
from guns
order by id desc;
-- name: InsertGun :one
INSERT into guns
(make, model, serial_number, purchase_amount, value_amount, date_purchased, notes) VALUES
(?, ?, ?, ?, ?, ?, ?) returning id