File tree Expand file tree Collapse file tree 3 files changed +15
-21
lines changed
src/expressions/functions Expand file tree Collapse file tree 3 files changed +15
-21
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @neo4j/cypher-builder " : major
3+ ---
4+
5+ Remove support for patterns in size.
6+
7+ _ No longer supported_
8+
9+ ``` js
10+ Cypher .size (new Cypher.Pattern (node));
11+ ```
12+
13+ Use ` new Cypher.Count(pattern) ` instead.
Original file line number Diff line number Diff line change @@ -102,12 +102,4 @@ describe("Scalar Functions", () => {
102102
103103 expect ( queryResult . cypher ) . toMatchInlineSnapshot ( `"size(\\"Hello\\")"` ) ;
104104 } ) ;
105-
106- test ( "size() applied to a pattern" , ( ) => {
107- const pattern = new Cypher . Pattern ( new Cypher . Node ( ) ) . related ( ) . to ( ) ;
108- const cypherFunction = Cypher . size ( pattern ) ;
109- const queryResult = new TestClause ( cypherFunction ) . build ( ) ;
110-
111- expect ( queryResult . cypher ) . toMatchInlineSnapshot ( `"size((this0)-[]->())"` ) ;
112- } ) ;
113105} ) ;
Original file line number Diff line number Diff line change 1717 * limitations under the License.
1818 */
1919
20- import { Raw } from "../../clauses/Raw" ;
21- import type { Pattern } from "../../pattern/Pattern" ;
2220import type { Expr } from "../../types" ;
2321import { CypherFunction } from "./CypherFunctions" ;
2422
@@ -99,17 +97,8 @@ export function randomUUID(): CypherFunction {
9997 * @group Functions
10098 * @category Scalar
10199 */
102- export function size ( expr : Expr ) : CypherFunction ;
103- /** @deprecated size() with pattern is deprecated in Neo4j 5 */
104- export function size ( expr : Pattern ) : CypherFunction ;
105- export function size ( expr : Expr | Pattern ) : CypherFunction {
106- // Support for patterns in size() in Neo4j 4
107- // Using Raw to avoid adding Patterns to CypherFunction
108- const sizeParam = new Raw ( ( env ) => {
109- return env . compile ( expr ) ;
110- } ) ;
111-
112- return new CypherFunction ( "size" , [ sizeParam ] ) ;
100+ export function size ( expr : Expr ) : CypherFunction {
101+ return new CypherFunction ( "size" , [ expr ] ) ;
113102}
114103
115104/**
You can’t perform that action at this time.
0 commit comments