-- name: CreatePackageType :one
INSERT INTO packagetypes (
    pgcode,
    pgdescription
 ) VALUES (
    $1, $2
 ) RETURNING *;

-- name: GetPackageType :one
SELECT * FROM packagetypes
WHERE id = $1 LIMIT 1;

-- name: ListPackageTypes :many
SELECT * FROM packagetypes
ORDER BY id LIMIT $1
OFFSET $2;

-- name: UpdatePackageType :one
UPDATE packagetypes
  set 
    pgcode= $2,
    pgdescription= $3
WHERE id = $1
RETURNING *;

-- name: DeletePackageType :exec
DELETE FROM packagetypes WHERE id= $1;