Neo4j.Sips v0.1.30 Neo4j.Sips.Transaction
This module is the main implementation for running Cypher commands using transactions. It is using the transactional HTTP endpoint for Cypher and has the ability to let you use the same transaction across multiple HTTP requests.
Every Cypher operation is executed in a transaction.
Example:
test "execute statements in an open transaction" do
conn = Neo4j.tx_begin(Neo4j.conn)
books = Neo4j.query(conn, "CREATE (b:Book {title:"The Game Of Trolls"}) return b")
assert {:ok, rows} = books
assert List.first(rows)["b"]["title"] == "The Game Of Trolls"
assert {:ok, conn} = Neo4j.tx_rollback(conn)
assert String.length(conn.commit_url) == 0
end
To do:
- let the user override the default TX timeout; the default timeout is 60 seconds.
- improve the errors handling
- Reset transaction timeout of an open transaction
- add support for returning results in graph format
Summary
Functions
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
commit an open transaction
send a list of cypher commands to the server. Each command will have this form: {query, params}, where the query is a valid Cypher command and the params are a map of optional parameters
send a single cypher command to the server, and an optional map of parameters
same as #tx_commit but maybe raise an error
Functions
Specs
tx_begin(Neo4j.Sips.Connection) :: Neo4j.Sips.Connection
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.
Specs
tx_commit(Neo4j.Sips.Connection) :: Neo4j.Sips.Response
commit an open transaction
Specs
tx_commit(Neo4j.Sips.Connection, String.t) :: Neo4j.Sips.Response
send a list of cypher commands to the server. Each command will have this form: {query, params}, where the query is a valid Cypher command and the params are a map of optional parameters.
send a single cypher command to the server, and an optional map of parameters
same as #tx_commit but maybe raise an error