-- name: CreateCompany :one
INSERT INTO companies (
        name,
        admin_id,
        wallet_id
    )
VALUES ($1, $2, $3)
RETURNING *;
-- name: GetAllCompanies :many
SELECT *
FROM companies_details;
-- name: GetCompanyByID :one
SELECT *
FROM companies_details
WHERE id = $1;
-- name: SearchCompanyByName :many
SELECT *
FROM companies_details
WHERE name ILIKE '%' || $1 || '%';
-- name: UpdateCompany :one
UPDATE companies
SET name = COALESCE(sqlc.narg(name), name),
    admin_id = COALESCE(sqlc.narg(admin_id), admin_id)
WHERE id = $1
RETURNING *;
-- name: DeleteCompany :exec
DELETE FROM companies
WHERE id = $1;