@neo4j/cypher-builder
Version:
A programmatic API for building Cypher queries for Neo4j
86 lines (85 loc) • 3.44 kB
TypeScript
import type { CypherEnvironment } from "../Environment";
import type { PathAssign } from "../pattern/PathAssign";
import type { Pattern } from "../pattern/Pattern";
import type { QuantifiedPath } from "../pattern/quantified-patterns/QuantifiedPath";
import { Clause } from "./Clause";
import { WithCall } from "./mixins/clauses/WithCall";
import { WithCallProcedure } from "./mixins/clauses/WithCallProcedure";
import { WithCreate } from "./mixins/clauses/WithCreate";
import { WithFilter } from "./mixins/clauses/WithFilter";
import { WithFinish } from "./mixins/clauses/WithFinish";
import { WithForeach } from "./mixins/clauses/WithForeach";
import { WithLet } from "./mixins/clauses/WithLet";
import { WithMatch } from "./mixins/clauses/WithMatch";
import { WithMerge } from "./mixins/clauses/WithMerge";
import { WithReturn } from "./mixins/clauses/WithReturn";
import { WithUnwind } from "./mixins/clauses/WithUnwind";
import { WithWith } from "./mixins/clauses/WithWith";
import { WithDelete } from "./mixins/sub-clauses/WithDelete";
import { WithOrder } from "./mixins/sub-clauses/WithOrder";
import { WithSetRemove } from "./mixins/sub-clauses/WithSetRemove";
import { WithWhere } from "./mixins/sub-clauses/WithWhere";
export interface Match extends WithReturn, WithWhere, WithSetRemove, WithWith, WithDelete, WithUnwind, WithCreate, WithMerge, WithFinish, WithCallProcedure, WithCall, WithOrder, WithForeach, WithLet, WithFilter, WithMatch {
}
/** Patterns supported by Match */
export type MatchClausePattern = Pattern | QuantifiedPath | PathAssign<Pattern | QuantifiedPath>;
/**
* @see {@link https://neo4j.com/docs/cypher-manual/current/clauses/match/ | Cypher Documentation}
* @group Clauses
*/
export declare class Match extends Clause {
private readonly patterns;
private _optional;
private shortestStatement;
private mode;
constructor(...patterns: MatchClausePattern[]);
/** Makes the clause an OPTIONAL MATCH
* @see {@link https://neo4j.com/docs/cypher-manual/current/clauses/optional-match/ | Cypher Documentation}
* @example
* ```ts
* new Cypher.Match(new Node({labels: ["Movie"]})).optional();
* ```
* _Cypher:_
* ```cypher
* OPTIONAL MATCH (this:Movie)
* ```
*/
optional(): this;
/**
* @since Neo4j 5.21
*/
shortest(k: number): this;
/**
* @since Neo4j 5.21
*/
shortestGroups(k: number): this;
/**
* @since Neo4j 5.21
*/
allShortest(): this;
/**
* @since Neo4j 5.21
*/
any(): this;
/** Add `REPEATABLE ELEMENTS` mode to `MATCH` clause
* @see {@link https://neo4j.com/docs/cypher-manual/25/patterns/match-modes/#repeatable-elements | Cypher Documentation}
* @since Neo4j 2025.06
*/
repeatableElements(): this;
/** Add `DIFFERENT RELATIONSHIPS` mode to `MATCH` clause
* @see {@link https://neo4j.com/docs/cypher-manual/25/patterns/match-modes/#different-relationships | Cypher Documentation}
* @since Neo4j 2025.06
*/
differentRelationships(): this;
/** @internal */
getCypher(env: CypherEnvironment): string;
private getShortestStatement;
private getModeStr;
}
/**
* @see {@link https://neo4j.com/docs/cypher-manual/current/clauses/optional-match/ | Cypher Documentation}
* @group Clauses
*/
export declare class OptionalMatch extends Match {
constructor(...patterns: MatchClausePattern[]);
}