sqldb/sqlc: remove deprecated FilterInvoices query

All call sites have been migrated to the targeted replacement queries
in the previous commit. Remove FilterInvoices and its associated
params struct from the SQL source and regenerate.
This commit is contained in:
ziggie committed 2026-02-21 16:58:31 +01:00
1 parent 774ebaf126
commit 9becdfa8a3
3 files changed
-154

No files matched your search

-111
View File
@@ -123,117 +123,6 @@ func (q *Queries) FetchPendingInvoices(ctx context.Context, arg FetchPendingInvo
return items, nil
}
const filterInvoices = `-- name: FilterInvoices :many
SELECT
invoices.id, invoices.hash, invoices.preimage, invoices.settle_index, invoices.settled_at, invoices.memo, invoices.amount_msat, invoices.cltv_delta, invoices.expiry, invoices.payment_addr, invoices.payment_request, invoices.payment_request_hash, invoices.state, invoices.amount_paid_msat, invoices.is_amp, invoices.is_hodl, invoices.is_keysend, invoices.created_at
FROM invoices
WHERE (
id >= $1 OR
$1 IS NULL
) AND (
id <= $2 OR
$2 IS NULL
) AND (
settle_index >= $3 OR
$3 IS NULL
) AND (
settle_index <= $4 OR
$4 IS NULL
) AND (
state = $5 OR
$5 IS NULL
) AND (
created_at >= $6 OR
$6 IS NULL
) AND (
created_at < $7 OR
$7 IS NULL
) AND (
CASE
WHEN $8 = TRUE THEN (state = 0 OR state = 3)
ELSE TRUE
END
)
ORDER BY
CASE
WHEN $9 = FALSE OR $9 IS NULL THEN id
ELSE NULL
END ASC,
CASE
WHEN $9 = TRUE THEN id
ELSE NULL
END DESC
LIMIT $11 OFFSET $10
`
type FilterInvoicesParams struct {
AddIndexGet sql.NullInt64
AddIndexLet sql.NullInt64
SettleIndexGet sql.NullInt64
SettleIndexLet sql.NullInt64
State sql.NullInt16
CreatedAfter sql.NullTime
CreatedBefore sql.NullTime
PendingOnly interface{}
Reverse interface{}
NumOffset int32
NumLimit int32
}
func (q *Queries) FilterInvoices(ctx context.Context, arg FilterInvoicesParams) ([]Invoice, error) {
rows, err := q.db.QueryContext(ctx, filterInvoices,
arg.AddIndexGet,
arg.AddIndexLet,
arg.SettleIndexGet,
arg.SettleIndexLet,
arg.State,
arg.CreatedAfter,
arg.CreatedBefore,
arg.PendingOnly,
arg.Reverse,
arg.NumOffset,
arg.NumLimit,
)
if err != nil {
return nil, err
}
defer rows.Close()
var items []Invoice
for rows.Next() {
var i Invoice
if err := rows.Scan(
&i.ID,
&i.Hash,
&i.Preimage,
&i.SettleIndex,
&i.SettledAt,
&i.Memo,
&i.AmountMsat,
&i.CltvDelta,
&i.Expiry,
&i.PaymentAddr,
&i.PaymentRequest,
&i.PaymentRequestHash,
&i.State,
&i.AmountPaidMsat,
&i.IsAmp,
&i.IsHodl,
&i.IsKeysend,
&i.CreatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const filterInvoicesByAddIndex = `-- name: FilterInvoicesByAddIndex :many
SELECT
invoices.id, invoices.hash, invoices.preimage, invoices.settle_index, invoices.settled_at, invoices.memo, invoices.amount_msat, invoices.cltv_delta, invoices.expiry, invoices.payment_addr, invoices.payment_request, invoices.payment_request_hash, invoices.state, invoices.amount_paid_msat, invoices.is_amp, invoices.is_hodl, invoices.is_keysend, invoices.created_at
-1
View File
@@ -36,7 +36,6 @@ type Querier interface {
// fast index scan rather than a full table scan.
FetchPendingInvoices(ctx context.Context, arg FetchPendingInvoicesParams) ([]Invoice, error)
FetchSettledAMPSubInvoices(ctx context.Context, arg FetchSettledAMPSubInvoicesParams) ([]FetchSettledAMPSubInvoicesRow, error)
FilterInvoices(ctx context.Context, arg FilterInvoicesParams) ([]Invoice, error)
// FilterInvoicesByAddIndex returns invoices whose add_index (primary key id)
// is greater than or equal to the given value, ordered by id. Because id is
// the primary key, this is always an efficient range scan on the clustered
-42
View File
@@ -132,48 +132,6 @@ WHERE id <= @add_index_let
ORDER BY id DESC
LIMIT @num_limit OFFSET @num_offset;
-- name: FilterInvoices :many
SELECT
invoices.*
FROM invoices
WHERE (
id >= sqlc.narg('add_index_get') OR
sqlc.narg('add_index_get') IS NULL
) AND (
id <= sqlc.narg('add_index_let') OR
sqlc.narg('add_index_let') IS NULL
) AND (
settle_index >= sqlc.narg('settle_index_get') OR
sqlc.narg('settle_index_get') IS NULL
) AND (
settle_index <= sqlc.narg('settle_index_let') OR
sqlc.narg('settle_index_let') IS NULL
) AND (
state = sqlc.narg('state') OR
sqlc.narg('state') IS NULL
) AND (
created_at >= sqlc.narg('created_after') OR
sqlc.narg('created_after') IS NULL
) AND (
created_at < sqlc.narg('created_before') OR
sqlc.narg('created_before') IS NULL
) AND (
CASE
WHEN sqlc.narg('pending_only') = TRUE THEN (state = 0 OR state = 3)
ELSE TRUE
END
)
ORDER BY
CASE
WHEN sqlc.narg('reverse') = FALSE OR sqlc.narg('reverse') IS NULL THEN id
ELSE NULL
END ASC,
CASE
WHEN sqlc.narg('reverse') = TRUE THEN id
ELSE NULL
END DESC
LIMIT @num_limit OFFSET @num_offset;
-- name: UpdateInvoiceState :execresult
UPDATE invoices
SET state = $2,