Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ON MATCH and ON CREATE
Added support for ON MATCH and ON CREATE which can follow a merge clause. Added some supporting test cases.
- Loading branch information
Showing
7 changed files
with
192 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.neo4j.cypherdsl.grammar; | ||
|
||
import org.neo4j.cypherdsl.SetProperty; | ||
|
||
/** | ||
* Represents the ON CREATE clause | ||
*/ | ||
public interface OnCreate | ||
{ | ||
UpdateNext onCreate( SetProperty... propertyValues ); | ||
|
||
UpdateNext onCreate( Iterable<SetProperty> propertyValues ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.neo4j.cypherdsl.grammar; | ||
|
||
import org.neo4j.cypherdsl.SetProperty; | ||
|
||
/** | ||
* Represents the ON MATCH clause | ||
*/ | ||
public interface OnMatch | ||
{ | ||
UpdateNext onMatch( SetProperty... propertyValues ); | ||
|
||
UpdateNext onMatch( Iterable<SetProperty> propertyValues ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/org/neo4j/cypherdsl/query/clause/OnCreateClause.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.neo4j.cypherdsl.query.clause; | ||
|
||
import org.neo4j.cypherdsl.SetProperty; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* ON CREATE clause | ||
*/ | ||
public class OnCreateClause | ||
extends Clause | ||
{ | ||
private final ArrayList<SetProperty> expressions = new ArrayList<SetProperty>(); | ||
|
||
public OnCreateClause( Iterable<SetProperty> expressions ) | ||
{ | ||
for ( SetProperty expression : expressions ) | ||
{ | ||
this.expressions.add( expression ); | ||
} | ||
} | ||
|
||
@Override | ||
public void asString( StringBuilder builder ) | ||
{ | ||
String name = " ON CREATE"; | ||
builder.append(name); | ||
clauseAsString( builder, "SET", expressions, "," ); | ||
} | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
src/main/java/org/neo4j/cypherdsl/query/clause/OnMatchClause.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.neo4j.cypherdsl.query.clause; | ||
|
||
import org.neo4j.cypherdsl.SetProperty; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* ON CREATE clause | ||
*/ | ||
public class OnMatchClause | ||
extends Clause | ||
{ | ||
private final ArrayList<SetProperty> expressions = new ArrayList<SetProperty>(); | ||
|
||
public OnMatchClause( Iterable<SetProperty> expressions ) | ||
{ | ||
for ( SetProperty expression : expressions ) | ||
{ | ||
this.expressions.add( expression ); | ||
} | ||
} | ||
|
||
@Override | ||
public void asString( StringBuilder builder ) | ||
{ | ||
String name = " ON MATCH"; | ||
builder.append(name); | ||
clauseAsString( builder, "SET", expressions, "," ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters