Module Neodriver_eio.Neo4jResult

A lazily-streamed query result (next/peek/fetch/consume/single).

A lazily-streamed query result. next/peek/fetch iterate the records (pulling from the connection on demand); consume drains the stream and returns its summary; single/single_optional enforce cardinality.

A deferred server failure is surfaced as Error once the buffered records before it have been consumed.

type t

A lazily-streamed result over a connection.

val make : ?fetch_size:int -> ?query:string -> ?parameters:(string * Neodriver_core.Values.t) list -> Conn.stream -> t

Wrap a stream (as produced by Session.run or Tx.run) into a t. fetch_size is the number of records pulled per PULL when the buffer runs out (default 1000).

val stream : t -> Conn.stream

The underlying stream (for the summary, buffered records and raw pull).

val keys : t -> string list

The field names of the returned records.

val next : t -> (Neodriver_core.Values.t list option, Neodriver_core.Errors.t) Stdlib.result

The next record, or None once the stream is exhausted.

val peek : t -> (Neodriver_core.Values.t list option, Neodriver_core.Errors.t) Stdlib.result

The next record without advancing past it.

val fetch : ?n:int -> t -> (Neodriver_core.Values.t list list, Neodriver_core.Errors.t) Stdlib.result

Up to n records (all remaining when n is omitted).

val values : t -> (Neodriver_core.Values.t list list, Neodriver_core.Errors.t) Stdlib.result

All remaining records.

val data : t -> ((string * Neodriver_core.Values.t) list list, Neodriver_core.Errors.t) Stdlib.result

All remaining records, each paired with its field names.

val consume : t -> (Summary.t, Neodriver_core.Errors.t) Stdlib.result

Drain the stream and return its summary.

val single : t -> (Neodriver_core.Values.t list, Neodriver_core.Errors.t) Stdlib.result

The single remaining record; an error unless exactly one.

val single_optional : t -> (Neodriver_core.Values.t list option, Neodriver_core.Errors.t) Stdlib.result

The single remaining record, or None; an error if more than one.