Module Neodriver_core.Values

Rich value types (graph, spatial, temporal, vector, unsupported, broken).

Rich value types for the Neo4j driver.

See values.ml for the implementation.

type node = {
  1. element_id : string;
  2. legacy_id : int option;
  3. labels : string list;
  4. properties : (string * t) list;
}

A graph node.

and relationship = {
  1. element_id : string;
  2. legacy_id : int option;
  3. rel_type : string;
  4. start : string;
  5. end_ : string;
  6. start_legacy_id : int option;
  7. end_legacy_id : int option;
  8. properties : (string * t) list;
}

A directed relationship with its endpoints' element_ids (and legacy ids when known).

and unbound_relationship = {
  1. element_id : string;
  2. legacy_id : int option;
  3. rel_type : string;
  4. properties : (string * t) list;
}

A relationship without resolved endpoints (as in a path).

and path = {
  1. nodes : node list;
  2. relationships : relationship list;
}

A path: the ordered nodes and the relationships linking them.

and point = {
  1. srid : int;
  2. x : float;
  3. y : float;
  4. z : float option;
}

A spatial point with its SRID and coordinates.

and vector_dtype =
  1. | I8
  2. | I16
  3. | I32
  4. | I64
  5. | F32
  6. | F64
    (*

    Element type of a vector.

    *)
and vector = {
  1. dtype : vector_dtype;
  2. data : bytes;
}

A big-endian vector of homogeneous elements.

and unsupported = {
  1. name : string;
  2. minimum_protocol_version : int * int;
  3. message : string option;
}

A server value type the driver does not understand.

and broken = {
  1. error : string;
  2. raw : Neodriver_packstream.Packstream.value;
}

A value that could not be decoded.

and t =
  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 t list
  8. | Map of (string * t) list
  9. | Node of node
  10. | Relationship of relationship
  11. | Unbound_relationship of unbound_relationship
  12. | Path of path
  13. | Point of point
  14. | Date of Temporal.Date.t
  15. | Time of Temporal.Time.t
  16. | DateTime of Temporal.DateTime.t
  17. | Duration of Temporal.Duration.t
  18. | Vector of vector
  19. | Unsupported of unsupported
  20. | Broken of broken
    (*

    A hydrated value exchanged with the server.

    *)
val point_x : point -> float

The x coordinate of a point.

val point_y : point -> float

The y coordinate of a point.

val point_z : point -> float option

The z coordinate of a point, if any.

val point_coordinates : point -> float list

The coordinates of a point as a list.

val point_is_cartesian : point -> bool

Whether a point uses a Cartesian SRID.

val point_is_wgs84 : point -> bool

Whether a point uses a WGS84 SRID.

val vector_dtype_size : vector_dtype -> int

Number of bytes per element of a vector dtype.

val vector_length : vector -> int

Number of elements in a vector.

val to_string : t -> string

Render a value as a human-readable string.