Module Neodriver_packstream.PackstreamSource

PackStream — binary serialization for the Neo4j Bolt protocol.

See packstream.ml for the implementation.

Sourcetype value =
  1. | Null
  2. | Bool of bool
  3. | Int of int64
  4. | Float of float
  5. | String of string
  6. | Bytes of bytes
  7. | List of value list
  8. | Map of (string * value) list
  9. | Structure of int * value list
  10. | Uuid of string
    (*

    A PackStream value; Structure carries a tag byte and its fields. Uuid (Bolt 6.1) carries a UUID in its canonical hyphenated lowercase text.

    *)
Sourcetype error =
  1. | Unexpected_end_of_data
  2. | Unknown_marker of int
  3. | Map_key_not_string
  4. | Depth_limit_exceeded of int
    (*

    Decode failures reported by unpack.

    *)
Sourcetype limits = {
  1. max_depth : int;
}

Limits for unpack, guarding against stack overflow on deeply nested values.

Sourceval default_limits : limits

Default limits: max_depth = 256.

Sourceval pack : value -> Bytes.t

Serialize a value into its PackStream byte representation. Raises Invalid_argument for a Structure with more than 15 fields, which PackStream cannot represent.

Sourceval unpack : ?limits:limits -> Bytes.t -> (value, error) result

Deserialize a value from PackStream bytes, subject to the given limits (defaults to default_limits).

Sourceval error_to_string : error -> string

Render a decode error as a human-readable message.

Sourceval to_string : value -> string

Render a value as a human-readable string.