Neo4j.Sips v0.1.30 Neo4j.Sips

Elixir driver for Neo4j

A module that provides a simple Interface to communicate with a Neo4j server via http, using Neo4j’s own REST API.

All functions take a pool to run the query on.

Summary

Functions

returns an environment specific Neo4j.Sips configuration

returns a Neo4j.Sips.Connection

returns a Connection containing the server details. You can specify some optional parameters i.e. graph_result

list all property keys ever used in the database. This also includes any property keys you have used, but deleted. There is currently no way to tell which ones are in use and which ones are not, short of walking the entire set of properties in the database

sends the query (and its parameters) to the server and returns {:ok, Neo4j.Sips.Response} or {:error, error} otherwise

send a query and an associated map of parameters. Returns the server response or an error

The same as query/2 but raises a Neo4j.Sips.Error if it fails. Returns the server response otherwise

The same as query/3 but raises a Neo4j.Sips.Error if it fails

returns the server version

begin a new transaction

given you have an open transaction, you can use this to send a commit request

execute a Cypher statement in a new or an existing transaction begin a new transaction. If there is no need to keep a transaction open across multiple HTTP requests, you can begin a transaction, execute statements, and commit with just a single HTTP request

execute a Cypher statement with a map containing associated parameters

See Neo4j.Sips.Transaction.tx_commit!/2

See Neo4j.Sips.Transaction.tx_commit!/3

given that you have an open transaction, you can send a rollback request. The server will rollback the transaction. Any further statements trying to run in this transaction will fail immediately

Functions

config()

returns an environment specific Neo4j.Sips configuration.

Example of valid configurations (i.e. defined in config/dev.exs):

# Neo4j server not requiring authentication
config :neo4j_sips, Neo4j,
  url: "http://localhost:7474"

# Neo4j server with username and password authentication
config :neo4j_sips, Neo4j,
  url: "http://localhost:7474",
  pool_size: 5,
  max_overflow: 2,
  timeout: 30,
  basic_auth: [username: "neo4j", password: "neo4j"]

# or using a token
config :neo4j_sips, Neo4j,
  url: "http://localhost:7474",
  pool_size: 10,
  max_overflow: 5,
  timeout: :infinity,
  token_auth: "bmVvNGo6dGVzdA=="
conn()

returns a Neo4j.Sips.Connection

conn(options)

returns a Connection containing the server details. You can specify some optional parameters i.e. graph_result.

graph_result is nil, by default, and can have the following values:

graph_result: ["row"]
graph_result: ["graph"]

or both:

graph_result: [ "row", "graph" ]
property_keys()

Specs

property_keys :: List.t | []

list all property keys ever used in the database. This also includes any property keys you have used, but deleted. There is currently no way to tell which ones are in use and which ones are not, short of walking the entire set of properties in the database.

query(conn, statement)

Specs

query(Neo4j.Sips.Connection, String.t) ::
  {:ok, Neo4j.Sips.Response} |
  {:error, Neo4j.Sips.Error}

sends the query (and its parameters) to the server and returns {:ok, Neo4j.Sips.Response} or {:error, error} otherwise

query(conn, statement, params)

Specs

query(Neo4j.Sips.Connection, String.t, Map.t) ::
  {:ok, Neo4j.Sips.Response} |
  {:error, Neo4j.Sips.Error}

send a query and an associated map of parameters. Returns the server response or an error

query!(conn, statement)

Specs

query!(Neo4j.Sips.Connection, String.t) ::
  Neo4j.Sips.Response |
  Neo4j.Sips.Error

The same as query/2 but raises a Neo4j.Sips.Error if it fails. Returns the server response otherwise.

query!(conn, statement, params)

Specs

query!(Neo4j.Sips.Connection, String.t, Map.t) ::
  Neo4j.Sips.Response |
  Neo4j.Sips.Error

The same as query/3 but raises a Neo4j.Sips.Error if it fails.

server_version()

Specs

server_version :: String.t

returns the server version

tx_begin(conn)

Specs

tx_begin(Neo4j.Sips.Connection) :: Neo4j.Sips.Connection

begin a new transaction.

tx_commit(conn)

Specs

tx_commit(Neo4j.Sips.Connection) :: Neo4j.Sips.Response

given you have an open transaction, you can use this to send a commit request

tx_commit(conn, statements)

Specs

tx_commit(Neo4j.Sips.Connection, String.t) :: Neo4j.Sips.Response

execute a Cypher statement in a new or an existing transaction begin a new transaction. If there is no need to keep a transaction open across multiple HTTP requests, you can begin a transaction, execute statements, and commit with just a single HTTP request.

tx_commit(conn, statement, params)

Specs

tx_commit(Neo4j.Sips.Connection, String.t, Map.t) :: Neo4j.Sips.Response

execute a Cypher statement with a map containing associated parameters

tx_commit!(conn, statements)

Specs

tx_commit!(Neo4j.Sips.Connection, String.t) :: Neo4j.Sips.Response

See Neo4j.Sips.Transaction.tx_commit!/2.

tx_commit!(conn, statement, params)

Specs

tx_commit!(Neo4j.Sips.Connection, String.t, Map.t) :: Neo4j.Sips.Response

See Neo4j.Sips.Transaction.tx_commit!/3.

tx_rollback(conn)

Specs

tx_rollback(Neo4j.Sips.Connection) :: Neo4j.Sips.Connection

given that you have an open transaction, you can send a rollback request. The server will rollback the transaction. Any further statements trying to run in this transaction will fail immediately.