UNPKG

@neo4j/cypher-builder

Version:

A programmatic API for building Cypher queries for Neo4j

79 lines (78 loc) 3.13 kB
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 { WithFinish } from "./mixins/clauses/WithFinish"; import { WithForeach } from "./mixins/clauses/WithForeach"; 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 { } /** 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 pattern; private _optional; private shortestStatement; constructor(pattern: 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; /** Add a {@link Match} clause * @see {@link https://neo4j.com/docs/cypher-manual/current/clauses/match/ | Cypher Documentation} */ match(clauseOrPattern: Match | MatchClausePattern): Match; /** Add an {@link OptionalMatch} clause * @see {@link https://neo4j.com/docs/cypher-manual/current/clauses/optional-match/ | Cypher Documentation} */ optionalMatch(clauseOrPattern: OptionalMatch | MatchClausePattern): OptionalMatch; /** * @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; /** @internal */ getCypher(env: CypherEnvironment): string; private getShortestStatement; } /** * @see {@link https://neo4j.com/docs/cypher-manual/current/clauses/optional-match/ | Cypher Documentation} * @group Clauses */ export declare class OptionalMatch extends Match { constructor(pattern: MatchClausePattern); }