UNPKG

@neo4j/cypher-builder

Version:

A programmatic API for building Cypher queries for Neo4j

94 lines (93 loc) 3.34 kB
import { CypherASTNode } from "../../CypherASTNode"; import type { Predicate } from "../../types"; type BooleanOperator = "AND" | "NOT" | "OR" | "XOR"; /** * @group Operators * @category Boolean */ export declare abstract class BooleanOp extends CypherASTNode { protected operator: BooleanOperator; /** @internal */ constructor(operator: BooleanOperator); } /** Generates an `AND` operator between the given predicates * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-boolean | Cypher Documentation} * @group Operators * @category Boolean * @example * ```ts * console.log("Test", Cypher.and( * Cypher.eq(new Cypher.Literal("Hi"), new Cypher.Literal("Hi")), * new Cypher.Literal(false)).toString() * ); * ``` * Translates to * ```cypher * "Hi" = "Hi" AND false * ``` * */ export declare function and(): undefined; export declare function and(left: Predicate, right: Predicate, ...extra: Array<Predicate | undefined>): BooleanOp; export declare function and(left: Predicate, ...extra: Array<Predicate | undefined>): Predicate; export declare function and(...ops: Array<Predicate | undefined>): Predicate | undefined; /** Generates an `NOT` operator before the given predicate * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-boolean | Cypher Documentation} * @group Operators * @category Boolean * @example * ```ts * console.log("Test", Cypher.not( * Cypher.eq(new Cypher.Literal("Hi"), new Cypher.Literal("Hi")) * ); * ``` * Translates to * ```cypher * NOT "Hi" = "Hi" * ``` * */ export declare function not(child: Predicate): BooleanOp; /** Generates an `OR` operator between the given predicates * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-boolean | Cypher Documentation} * @group Operators * @category Boolean * @example * ```ts * console.log("Test", Cypher.or( * Cypher.eq(new Cypher.Literal("Hi"), new Cypher.Literal("Hi")), * new Cypher.Literal(false)).toString() * ); * ``` * Translates to * ```cypher * "Hi" = "Hi" OR false * ``` * */ export declare function or(): undefined; export declare function or(left: Predicate, right: Predicate, ...extra: Array<Predicate | undefined>): BooleanOp; export declare function or(left: Predicate, ...extra: Array<Predicate | undefined>): Predicate; export declare function or(...ops: Array<Predicate | undefined>): Predicate | undefined; /** Generates an `XOR` operator between the given predicates * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-boolean | Cypher Documentation} * @group Operators * @category Boolean * @example * ```ts * console.log("Test", Cypher.xor( * Cypher.eq(new Cypher.Literal("Hi"), new Cypher.Literal("Hi")), * new Cypher.Literal(false)).toString() * ); * ``` * Translates to * ```cypher * "Hi" = "Hi" XOR false * ``` * */ export declare function xor(): undefined; export declare function xor(left: Predicate, right: Predicate, ...extra: Array<Predicate | undefined>): BooleanOp; export declare function xor(left: Predicate, ...extra: Array<Predicate | undefined>): Predicate; export declare function xor(...ops: Array<Predicate | undefined>): Predicate | undefined; export {};