Skip to content

Commit

Permalink
support any convertible map like LiftedMap
Browse files Browse the repository at this point in the history
  • Loading branch information
krabbit93 committed Apr 1, 2021
1 parent 21267c3 commit a504abc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,8 @@ package object syntax extends CypherSyntaxLowPriorityImplicits {
def :=(props: Expr[Map[String, Expr[_]]]): CF.Clause.SetNode =
CF.Clause.SetNode(e.asInstanceOf[Expr[Map[String, Any]]], props)

def +=(props: Expr[Map[String, Expr[_]]]): CF.Clause.ExtendNode =
CF.Clause.ExtendNode(e.asInstanceOf[Expr[Map[String, Any]]], props)
def +=[A](props: Expr[Map[String, A]]): CF.Clause.ExtendNode =
CF.Clause.ExtendNode(e.asInstanceOf[Expr[Map[String, Any]]], props.asInstanceOf[Expr[Map[String, Expr[_]]]])

def setProp: set.type = set
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ class CypherSyntaxWriteSpec extends CypherSyntaxBaseSpec {
"RETURN `id`(`n0`)"
).returns[Long]

"support settings node properties from map extending properties with lifted map" in
test(
Match { case n @ Node("id" := "123") =>
Update(n += lit(LiftedMap("foo" -> "qwerty", "bar" -> 123))) {
n.id
}
},
"MATCH (`n0`{ `id`: \"123\" }) " +
"SET `n0` += {`foo`: \"qwerty\", `bar`: 123} " +
"RETURN `id`(`n0`)"
).returns[Long]

"support setting relationship properties" in
test(
Match { case (a @ Node("A")) - (e @ Rel("E")) > (b @ Node("B")) =>
Expand Down

0 comments on commit a504abc

Please sign in to comment.