-- name: CreatePayee :one
INSERT INTO payees
(name, budget_id)
VALUES ($1, $2)
RETURNING *;

-- name: GetPayees :many
SELECT payees.* FROM payees 
WHERE payees.budget_id = $1
ORDER BY name;

-- name: SearchPayees :many
SELECT payees.*, 'payee' as type FROM payees 
WHERE payees.budget_id = @budget_id
AND payees.name LIKE @search
ORDER BY payees.name;
--ORDER BY levenshtein(payees.name, $2);