-
Notifications
You must be signed in to change notification settings - Fork 2
NeoQuery
Michel Perez edited this page Oct 18, 2015
·
2 revisions
NeoQuery allows you to transform the results that you get from an anorm query:
val query = s"match (n:user { id: "1"}) return n".stripMargin
val res = Cypher(query).as(get[org.anormcypher.NeoNode]("n") *)
val listRes = NeoQuery.transformI[MyUser](res)
You can query a node by it's ID
NeoQuery.findById[MyUser]("1", Some("user"))
You can execute a query and get the result as a List of nodes or List of relationships:
val query =
s"""
match (a:user { id: "${node1.id}"}), (b:user { id: "${node2.id}"}),
(a)-[c:friendship]->(b) return a, b, c
""".stripMargin
val fut = NeoQuery.executeQuery[MyUser, MyUser, MyRelSeq](query)