File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
src/core/database/query-augmentation Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,4 @@ import './map';
11
11
import './pattern-formatting' ;
12
12
import './subquery' ;
13
13
import './summary' ;
14
+ import './yield' ;
Original file line number Diff line number Diff line change
1
+ import { Many } from '@seedcompany/common' ;
2
+ import { Clause , Query } from 'cypher-query-builder' ;
3
+
4
+ declare module 'cypher-query-builder/dist/typings/query' {
5
+ interface Query {
6
+ yield ( ...terms : Array < Many < string > > ) : this;
7
+ }
8
+ }
9
+
10
+ Query . prototype . yield = function ( this : Query , ...terms : Array < Many < string > > ) {
11
+ const flattened = terms . flat ( ) ;
12
+ if ( flattened . length === 0 ) return this ;
13
+ return this . continueChainClause ( new Yield ( flattened ) ) ;
14
+ } ;
15
+
16
+ class Yield extends Clause {
17
+ constructor ( public terms : readonly string [ ] ) {
18
+ super ( ) ;
19
+ }
20
+ build ( ) {
21
+ return `YIELD ${ this . terms . join ( ', ' ) } ` ;
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments