mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
sqldb: add invoice event queries
This commit is contained in:
parent
fb16287b31
commit
877b711360
35
sqldb/sqlc/queries/invoice_events.sql
Normal file
35
sqldb/sqlc/queries/invoice_events.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
-- name: InsertInvoiceEvent :exec
|
||||||
|
INSERT INTO invoice_events (
|
||||||
|
created_at, invoice_id, htlc_id, set_id, event_type, event_metadata
|
||||||
|
) VALUES (
|
||||||
|
$1, $2, $3, $4, $5, $6
|
||||||
|
);
|
||||||
|
|
||||||
|
-- name: SelectInvoiceEvents :many
|
||||||
|
SELECT *
|
||||||
|
FROM invoice_events
|
||||||
|
WHERE (
|
||||||
|
invoice_id = sqlc.narg('invoice_id') OR
|
||||||
|
sqlc.narg('invoice_id') IS NULL
|
||||||
|
) AND (
|
||||||
|
htlc_id = sqlc.narg('htlc_id') OR
|
||||||
|
sqlc.narg('htlc_id') IS NULL
|
||||||
|
) AND (
|
||||||
|
set_id = sqlc.narg('set_id') OR
|
||||||
|
sqlc.narg('set_id') IS NULL
|
||||||
|
) AND (
|
||||||
|
event_type = sqlc.narg('event_type') OR
|
||||||
|
sqlc.narg('event_type') 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
|
||||||
|
)
|
||||||
|
LIMIT @num_limit OFFSET @num_offset;
|
||||||
|
|
||||||
|
-- name: DeleteInvoiceEvents :exec
|
||||||
|
DELETE
|
||||||
|
FROM invoice_events
|
||||||
|
WHERE invoice_id = $1;
|
Loading…
Reference in New Issue
Block a user