UNPKG

@neo4j/cypher-builder

Version:

A programmatic API for building Cypher queries for Neo4j

133 lines (132 loc) 5.66 kB
import { CypherASTNode } from "../../CypherASTNode"; import type { CypherEnvironment } from "../../Environment"; import type { Expr, NormalizationType } from "../../types"; type ComparisonOperator = "=" | "<" | ">" | "<>" | "<=" | ">=" | "IS NULL" | "IS NOT NULL" | "IN" | "CONTAINS" | "STARTS WITH" | "ENDS WITH" | "=~" | "IS NORMALIZED" | "IS NOT NORMALIZED"; /** * Comparison operator expression. Created using comparison operator functions. * @group Operators * @category Comparison * @example * ``` * const op = Cypher.gt(var1, var2); * ``` */ export declare class ComparisonOp extends CypherASTNode { protected operator: ComparisonOperator; protected leftExpr: Expr; protected rightExpr: Expr | undefined; /** @internal */ constructor(operator: ComparisonOperator, left: Expr, right: Expr | undefined); /** * @internal */ getCypher(env: CypherEnvironment): string; } export declare class NormalizationOperator extends ComparisonOp { private readonly normalizationType; constructor(operator: "IS NORMALIZED" | "IS NOT NORMALIZED", left: Expr, normalizationType: NormalizationType | undefined); /** * @internal */ getCypher(env: CypherEnvironment): string; } /** Equality (`=`) operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function eq(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** Inequality (`<>`) operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function neq(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** Greater Than (`>`) operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function gt(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** Greater Than Equal (`>=`) operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function gte(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** Less Than (`<`) operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function lt(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** Less Than Equal (`<=`) operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function lte(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** `IS NULL` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison * @example * ```cypher * this0.title IS NULL * ``` */ export declare function isNull(childExpr: Expr): ComparisonOp; /** `IS NOT NULL` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison * @example * ```cypher * this0.title IS NULL * ``` */ export declare function isNotNull(childExpr: Expr): ComparisonOp; /** `IN` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function inOp(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** `CONTAINS` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function contains(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** `STARTS WITH` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function startsWith(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** `ENDS WITH` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function endsWith(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** Matching (=~) operator. * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function matches(leftExpr: Expr, rightExpr: Expr): ComparisonOp; /** `IS NORMALIZED` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison * @since Neo4j 5.17 */ export declare function isNormalized(leftExpr: Expr, normalizationType?: NormalizationType): ComparisonOp; /** `IS NOT NORMALIZED` operator * @see {@link https://neo4j.com/docs/cypher-manual/current/syntax/operators/#query-operators-comparison | Cypher Documentation} * @group Operators * @category Comparison */ export declare function isNotNormalized(leftExpr: Expr, normalizationType?: NormalizationType): ComparisonOp; export {};