UNPKG

@neo4j/cypher-builder

Version:

A programmatic API for building Cypher queries for Neo4j

40 lines (39 loc) 929 B
"use strict"; /* * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CypherASTNode = void 0; /** Abstract class representing a Cypher Statement in the AST * @internal */ class CypherASTNode { parent; /** @internal */ constructor(parent) { this.parent = parent; } /** @internal */ getRoot() { if (this.parent) { return this.parent.getRoot(); } return this; } /** Sets the parent-child relationship for build traversal */ addChildren(...nodes) { for (const node of nodes) { if (node instanceof CypherASTNode) { node.setParent(this); } } } setParent(node) { this.parent = node; } get isRoot() { return this.parent === undefined; } } exports.CypherASTNode = CypherASTNode;