Your commit is writing checks your merge can't cash.
This commit is contained in:
@@ -188,3 +188,34 @@ func (q *Queries) InsertGunPhoto(ctx context.Context, arg InsertGunPhotoParams)
|
||||
_, err := q.db.ExecContext(ctx, insertGunPhoto, arg.GunID, arg.Photo, arg.Filename)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateGun = `-- name: UpdateGun :exec
|
||||
UPDATE guns
|
||||
set make = ?, model = ?, serial_number = ?, purchase_amount = ?, value_amount = ?, date_purchased = ?, notes = ?
|
||||
where id = ?
|
||||
`
|
||||
|
||||
type UpdateGunParams struct {
|
||||
Make sql.NullString `json:"make"`
|
||||
Model sql.NullString `json:"model"`
|
||||
SerialNumber sql.NullString `json:"serial_number"`
|
||||
PurchaseAmount sql.NullInt64 `json:"purchase_amount"`
|
||||
ValueAmount sql.NullInt64 `json:"value_amount"`
|
||||
DatePurchased sql.NullString `json:"date_purchased"`
|
||||
Notes sql.NullString `json:"notes"`
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateGun(ctx context.Context, arg UpdateGunParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateGun,
|
||||
arg.Make,
|
||||
arg.Model,
|
||||
arg.SerialNumber,
|
||||
arg.PurchaseAmount,
|
||||
arg.ValueAmount,
|
||||
arg.DatePurchased,
|
||||
arg.Notes,
|
||||
arg.ID,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
@@ -19,6 +19,11 @@ INSERT into guns
|
||||
(make, model, serial_number, purchase_amount, value_amount, date_purchased, notes) VALUES
|
||||
(?, ?, ?, ?, ?, ?, ?) returning id;
|
||||
|
||||
-- name: UpdateGun :exec
|
||||
UPDATE guns
|
||||
set make = ?, model = ?, serial_number = ?, purchase_amount = ?, value_amount = ?, date_purchased = ?, notes = ?
|
||||
where id = ?;
|
||||
|
||||
-- name: DeleteGun :exec
|
||||
DELETE from guns where id = ?;
|
||||
|
||||
|
Reference in New Issue
Block a user