andreasronge/neoxir
An Elixir driver for the Neo4j Graph Database, see www.neo4j.org
{ "createdAt": "2015-01-05T16:09:31Z", "defaultBranch": "master", "description": "An Elixir driver for the Neo4j Graph Database, see www.neo4j.org", "fullName": "andreasronge/neoxir", "homepage": null, "language": "Elixir", "name": "neoxir", "pushedAt": "2016-04-06T07:10:28Z", "stargazersCount": 28, "topics": [], "updatedAt": "2024-09-21T19:51:38Z", "url": "https://github.com/andreasronge/neoxir"}Neoxir
Section titled “Neoxir”An Elixir driver for the Neo4j Graph Database, see www.neo4j.org
Create a session
Section titled “Create a session”{:ok, session} = Neoxir.create_session("http://localhost:7474")Or
session = Neoxir.create_session! # http://localhost:7474 is defaultTransactions
Section titled “Transactions”All cypher operations are executed in transactions.
Commit a single cypher query
{:ok, response} = Neoxir.commit(session, statement: "CREATE (n) RETURN ID(n)")
# or, which might raise an exception:response = Neoxir.commit!(session, statement: "CREATE (n) RETURN ID(n)")Commit multiple cypher queries:
{:ok, response} = Neoxir.commit(session, [statement: "CREATE (n) RETURN ID(n)", statement: "..."])Reuse transaction
Section titled “Reuse transaction”TODO
transaction = Neoxir.begin_tx!(session, \\ [statements: "..."])response = Neoxir.execute!(transaction, statement: "CREATE (n) RETURN ID(n)")Neoxir.commit!(transaction, \\ [statements: "..."])Cypher Response
Section titled “Cypher Response”Single statement
{:ok, response} = Neoxir.commit(session, statement: "MATCH (n) RETURN ID(n) as X LIMIT 3")# => [%{x: 0}, %{x: 1}, %{x: 2}]REST response
{:ok, response} = commit(session, statement: "CREATE (n {name: 'andreas'}) RETURN n", resultDataContents: [ "REST" ])# => [%{n: %{"all_relationships" => "http://localhost:7474/db/data/node/886/relationships/all",# "all_typed_relationships" => "http://localhost:7474/db/data/node/886/relationships/all/{-list|&|types}",# ...Multiple statements
{:ok, response} = Neoxir.commit(session, [statement: "MATCH (n) RETURN ID(n) as X LIMIT 3"])# => [[%{x: 0}, %{x: 1}, %{x: 2}]]