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:
3 files changed
-154
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user