package neodriver

  1. Overview
  2. Docs

neodriver

The friendly entry point of the driver: open Neodriver exposes the whole API (the neodriver_packstream, neodriver_core and neodriver_eio packages) under one namespace with short names.

Features

  • Bolt protocol 3.0, 4.2-4.4, 5.0-5.8 and 6.0.
  • Plain bolt:// and TLS bolt+s:// / bolt+ssc:// connections.
  • Auto-commit queries with lazy streaming results (Neo4jResult / Summary).
  • Explicit and managed transactions with automatic retry.
  • Bookmarks.
  • Temporal types with named time zones (embedded IANA database plus an LMT fallback before 1970).
  • Basic authentication (LOGON after HELLO on Bolt >= 5.1).
  • TestKit conformance: 114 of 126 tests passing (12 skipped).

Documentation

  • Quickstart — the first program.
  • Usage — sessions, transactions, value types, errors.
  • Examples — runnable programs.
  • PLAN.md — the implementation plan and the status of every phase.

Quickstart

Add the driver to your dune project with neodriver and neodriver_eio (and Eio_main to run Eio_main.run). A minimal program that connects and runs a query:

open Neodriver

let () =
  Eio_main.run (fun env ->
    let net = Eio.Stdenv.net env in
    let clock = Eio.Stdenv.mono_clock env in
    Eio.Switch.run (fun sw ->
      let session =
        match
          Driver.connect ~uri:"bolt://localhost:7687"
            ~auth:(Conn.basic_auth ~credentials:"your_password" ())
            net clock sw
        with
        | Ok session -> session
        | Error error -> failwith (Errors.to_string error)
      in
      match Session.run session ~query:"RETURN 1 AS n" ~parameters:[] with
      | Ok result -> (
          match Neo4jResult.values result with
          | Ok [ [ Values.Int n ] ] -> Printf.printf "n = %Ld\n%!" n
          | _ -> ())
      | Error error -> failwith (Errors.to_string error)))

Packages

The four opam packages, in dependency order:

  • neodriver — this aggregator: open Neodriver covers the whole API.
  • neodriver_packstream — PackStream binary serialization.
  • neodriver_core — transport-agnostic core (errors, config, temporal values, hydration).
  • neodriver_eio — the Eio (OCaml 5) backend.

API reference

The per-package module documentation (each root module re-exports its API):

  • Neodriver — the aggregator (see also the Modules list below).
  • Neodriver_core — Errors, Config, Addressing, Deadline, Temporal, Values, Hydration, Capabilities.
  • Neodriver_eio — Driver, Conn, Session, Tx, Neo4jResult, Summary, Transport, Bolt, State, Handshake.
  • Neodriver_packstream — Packstream.

Modules

The root Neodriver re-exports the whole API: