Bolt.Sips v0.4.12 Bolt.Sips.Transaction View Source

This module is the main implementation for running Cypher commands using transactions.

Example:

test "execute statements in an open transaction" do
  conn = Bolt.Sips.begin(Bolt.Sips.conn)
  book = Bolt.Sips.query!(conn, "CREATE (b:Book {title: "The Game Of Trolls"}) return b") |> List.first
  assert %{"b" => g_o_t} = book
  assert g_o_t.properties["title"] == "The Game Of Trolls"
  Bolt.Sips.rollback(conn)
  books = Bolt.Sips.query!(conn, "MATCH (b:Book {title: "The Game Of Trolls"}) return b")
  assert length(books) == 0
end

Link to this section Summary

Functions

begin a new transaction

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

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

Link to this section Functions

Link to this function begin(conn) View Source
begin(Bolt.Sips.Connection) :: []

begin a new transaction.

Link to this function commit(conn) View Source
commit(Bolt.Sips.Connection) :: []

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

Link to this function rollback(conn) View Source
rollback(Bolt.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.