sqldb/sqlc: add NodeExists query
This commit is contained in:
3 files changed
+30
No files matched your search
@@ -3537,6 +3537,27 @@ func (q *Queries) ListNodesPaginated(ctx context.Context, arg ListNodesPaginated
|
|||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nodeExists = `-- name: NodeExists :one
|
||||||
|
SELECT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM graph_nodes
|
||||||
|
WHERE pub_key = $1
|
||||||
|
AND version = $2
|
||||||
|
) AS node_exists
|
||||||
|
`
|
||||||
|
|
||||||
|
type NodeExistsParams struct {
|
||||||
|
PubKey []byte
|
||||||
|
Version int16
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) NodeExists(ctx context.Context, arg NodeExistsParams) (bool, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, nodeExists, arg.PubKey, arg.Version)
|
||||||
|
var node_exists bool
|
||||||
|
err := row.Scan(&node_exists)
|
||||||
|
return node_exists, err
|
||||||
|
}
|
||||||
|
|
||||||
const upsertChanPolicyExtraType = `-- name: UpsertChanPolicyExtraType :exec
|
const upsertChanPolicyExtraType = `-- name: UpsertChanPolicyExtraType :exec
|
||||||
/* ─────────────────────────────────────────────
|
/* ─────────────────────────────────────────────
|
||||||
graph_channel_policy_extra_types table queries
|
graph_channel_policy_extra_types table queries
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ type Querier interface {
|
|||||||
ListNodeIDsAndPubKeys(ctx context.Context, arg ListNodeIDsAndPubKeysParams) ([]ListNodeIDsAndPubKeysRow, error)
|
ListNodeIDsAndPubKeys(ctx context.Context, arg ListNodeIDsAndPubKeysParams) ([]ListNodeIDsAndPubKeysRow, error)
|
||||||
ListNodesPaginated(ctx context.Context, arg ListNodesPaginatedParams) ([]GraphNode, error)
|
ListNodesPaginated(ctx context.Context, arg ListNodesPaginatedParams) ([]GraphNode, error)
|
||||||
NextInvoiceSettleIndex(ctx context.Context) (int64, error)
|
NextInvoiceSettleIndex(ctx context.Context) (int64, error)
|
||||||
|
NodeExists(ctx context.Context, arg NodeExistsParams) (bool, error)
|
||||||
OnAMPSubInvoiceCanceled(ctx context.Context, arg OnAMPSubInvoiceCanceledParams) error
|
OnAMPSubInvoiceCanceled(ctx context.Context, arg OnAMPSubInvoiceCanceledParams) error
|
||||||
OnAMPSubInvoiceCreated(ctx context.Context, arg OnAMPSubInvoiceCreatedParams) error
|
OnAMPSubInvoiceCreated(ctx context.Context, arg OnAMPSubInvoiceCreatedParams) error
|
||||||
OnAMPSubInvoiceSettled(ctx context.Context, arg OnAMPSubInvoiceSettledParams) error
|
OnAMPSubInvoiceSettled(ctx context.Context, arg OnAMPSubInvoiceSettledParams) error
|
||||||
|
|||||||
@@ -59,6 +59,14 @@ FROM graph_nodes
|
|||||||
WHERE pub_key = $1
|
WHERE pub_key = $1
|
||||||
AND version = $2;
|
AND version = $2;
|
||||||
|
|
||||||
|
-- name: NodeExists :one
|
||||||
|
SELECT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM graph_nodes
|
||||||
|
WHERE pub_key = $1
|
||||||
|
AND version = $2
|
||||||
|
) AS node_exists;
|
||||||
|
|
||||||
-- name: GetNodeIDByPubKey :one
|
-- name: GetNodeIDByPubKey :one
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM graph_nodes
|
FROM graph_nodes
|
||||||
|
|||||||
Reference in new issue
Block a user