View Source Bolt.Sips.Internals.BoltProtocolV3 (Boltx v0.0.1)

Summary

Functions

Implementation of Bolt's BEGIN. It opens a transaction.

Implementation of Bolt's COMMIT. It commits the open transaction.

Implementation of Bolt's RUN. It closes the connection.

Implementation of Bolt's HELLO. It initialises the connection.

Implementation of Bolt's ROLLBACK. It rollbacks the open transaction.

Implementation of Bolt's RUN. It passes a statement for execution on the server.

Runs a statement (most likely Cypher statement) and returns a list of the records and a summary (Act as as a RUN + PULL_ALL).

Functions

Link to this function

begin(transport, port, bolt_version, metadata, options)

View Source
@spec begin(atom(), port(), integer(), Bolt.Sips.Metadata.t() | map(), Keyword.t()) ::
  {:ok, any()} | Bolt.Sips.Internals.Error.t()

Implementation of Bolt's BEGIN. It opens a transaction.

Options

See "Shared options" in Bolt.Sips.Internals.BoltProtocolHelper documentation.

Example

iex> BoltProtocolV3.begin(:gen_tcp, port, 3, [])
{:ok, metadata}
Link to this function

commit(transport, port, bolt_version, options)

View Source
@spec commit(atom(), port(), integer(), Keyword.t()) ::
  {:ok, any()} | Bolt.Sips.Internals.Error.t()

Implementation of Bolt's COMMIT. It commits the open transaction.

Options

See "Shared options" in Bolt.Sips.Internals.BoltProtocolHelper documentation.

Example

iex> BoltProtocolV3.commit(:gen_tcp, port, 3, [])
:ok
Link to this function

goodbye(transport, port, bolt_version)

View Source

Implementation of Bolt's RUN. It closes the connection.

Options

See "Shared options" in Bolt.Sips.Internals.BoltProtocolHelper documentation.

Examples

iex> Bolt.Sips.Internals.BoltProtocolV3.goodbye(:gen_tcp, port, 3)
:ok

iex> Bolt.Sips.Internals.BoltProtocolV3.goodbye(:gen_tcp, port, 3)
:ok
Link to this function

hello(transport, port, bolt_version, auth, options \\ [recv_timeout: 15000])

View Source
@spec hello(atom(), port(), integer(), tuple(), Keyword.t()) ::
  {:ok, any()} | {:error, Bolt.Sips.Internals.Error.t()}

Implementation of Bolt's HELLO. It initialises the connection.

Expects a transport module (i.e. gen_tcp) and a Port. Accepts authorisation params in the form of {username, password}.

Options

See "Shared options" in Bolt.Sips.Internals.BoltProtocolHelper documentation.

Examples

iex> Bolt.Sips.Internals.BoltProtocolV3.hello(:gen_tcp, port, 3, {}, [])
{:ok, info}

iex> Bolt.Sips.Internals.BoltProtocolV3.hello(:gen_tcp, port, 3, {"username", "password"}, [])
{:ok, info}
Link to this function

rollback(transport, port, bolt_version, options)

View Source
@spec rollback(atom(), port(), integer(), Keyword.t()) ::
  :ok | Bolt.Sips.Internals.Error.t()

Implementation of Bolt's ROLLBACK. It rollbacks the open transaction.

Options

See "Shared options" in Bolt.Sips.Internals.BoltProtocolHelper documentation.

Example

iex> BoltProtocolV3.rollback(:gen_tcp, port, 3, [])
:ok
Link to this function

run(transport, port, bolt_version, statement, params, metadata, options)

View Source
@spec run(
  atom(),
  port(),
  integer(),
  String.t(),
  map(),
  Bolt.Sips.Metadata.t(),
  Keyword.t()
) ::
  {:ok, any()} | {:error, Bolt.Sips.Internals.Error.t()}

Implementation of Bolt's RUN. It passes a statement for execution on the server.

Note that this message doesn't return the statement result. For this purpose, use PULL_ALL. In bolt >= 3, run has an additional paramters; metadata

Options

See "Shared options" in Bolt.Sips.Internals.BoltProtocolHelper documentation.

Example

iex> BoltProtocolV1.run(:gen_tcp, port, 1, "RETURN $num AS num", %{num: 5}, %{}, [])
{:ok, {:success, %{"fields" => ["num"]}}}
Link to this function

run_statement(transport, port, bolt_version, statement, params, metadata, options)

View Source
@spec run_statement(
  atom(),
  port(),
  integer(),
  String.t(),
  map(),
  Bolt.Sips.Metadata.t(),
  Keyword.t()
) ::
  [Bolt.Sips.Internals.PackStream.Message.decoded()]
  | Bolt.Sips.Internals.Error.t()

Runs a statement (most likely Cypher statement) and returns a list of the records and a summary (Act as as a RUN + PULL_ALL).

Records are represented using PackStream's record data type. Their Elixir representation is a Keyword with the indexes :sig and :fields.

Options

See "Shared options" in Bolt.Sips.Internals.BoltProtocolHelper documentation.

Examples

iex> Bolt.Sips.Internals.BoltProtocol.run_statement(:gen_tcp, port, 1, "MATCH (n) RETURN n")
[
  {:success, %{"fields" => ["n"]}},
  {:record, [sig: 1, fields: [1, "Example", "Labels", %{"some_attribute" => "some_value"}]]},
  {:success, %{"type" => "r"}}
]