Boltx

Boltx is an Elixir driver for Neo4j/Bolt Protocol.

  • Supports Neo4j versions: 3.0.x/3.1.x/3.2.x/3.4.x/3.5.x/4.x/5.9 -5.13.0
  • Supports Bolt version: 1.0/2.0/3.0/4.x/5.0/5.1/5.2/5.3/5.4
  • Supports transactions, prepared queries, streaming, pooling and more via DBConnection
  • Automatic decoding and encoding of Elixir values

Documentation: https://hexdocs.pm/boltx

Features

FeatureImplemented
QuerysYES
TransactionsYES
Multi tenancyNO
Stream capabilitiesNO
RoutingNO

Usage

Add :boltx to your dependencies:

def deps() do
  [
    {:boltx, "~> 0.0.2"}
  ]
end

Using the latest version.


opts = [
    hostname: "127.0.0.1",
    auth: [username: "neo4j", password: ""],
    user_agent: "boltxTest/1",
    pool_size: 15,
    max_overflow: 3,
    prefix: :default
]

iex> {:ok, conn} = Boltx.start_link(opts)
{:ok, #PID<0.237.0>}

iex> Boltx.query!(conn, "return 1 as n") |> Boltx.Response.first()
%{"n" => 1}

# Commit is performed automatically if everythings went fine
Boltx.transaction(conn, fn conn ->
  result = Boltx.query!(conn, "CREATE (m:Movie {title: "Matrix"}) RETURN m")
end)

Bolt Protocol message

MessageBolt VersionImplemented
INITV1, V2YES
HELLOV3, V4.x, v5.1, v5.2, v5.3, v5.4YES
LOGONV3, V4.x, v5.1, v5.2, v5.3, v5.4YES
RUNV1, V2, V3, V4.x, v5.1, v5.2, v5.3, v5.4YES
PULLV1, V2, V3, V4.x, v5.1, v5.2, v5.3, v5.4YES
BEGINV1, V2, V3, V4.x, v5.1, v5.2, v5.3, v5.4YES
COMMITV1, V2, V3, V4.x, v5.1, v5.2, v5.3, v5.4YES
ROLLBACKV1, V2, V3, V4.x, v5.1, v5.2, v5.3, v5.4YES
LOGOFFV3, V4.x, v5.1, v5.2, v5.3, v5.4YES
TELEMETRYV5.4NO
GOODBYEV3, V4.x, v5.1, v5.2, v5.3, v5.4YES
RESETV3, V4.x, v5.1, v5.2, v5.3, v5.4YES
DISCARDV1, V2, V3, V4.x, v5.1, v5.2, v5.3, v5.4YES
ROUTEV4.x, v5.1, v5.2, v5.3, v5.4NO
ACK_FAILUREV1, V2YES