Crdt.Pointer
crdt · API reference
JSON Pointer (RFC 6901) for path-based access
JSON Pointer (RFC 6901) implementation.
JSON Pointer defines a string syntax for identifying a specific value within a JSON document. Example: "/foo/0/bar"
type t = string listA JSON Pointer is a list of reference tokens
val empty : tempty is the root pointer
val of_string : string -> (t, string) resultof_string s parses a JSON Pointer string. Returns Error if the string is invalid.
val to_string : t -> stringto_string p converts a pointer to its string representation
val append : t -> string -> tappend p token adds a token to the pointer
val parent : t -> t optionparent p returns the parent pointer, or None if already root
val last : t -> string optionlast p returns the last token, or None if root pointer
val length : t -> intlength p returns the number of tokens
val is_root : t -> boolis_root p returns true if this is the root pointer
val concat : t -> t -> tconcat p1 p2 concatenates two pointers
val resolve : t -> Value.t -> Value.t optionresolve p v resolves a pointer against a Value.t, returning the value at that path
val pp : Format.formatter -> t -> unitpp fmt p pretty-prints a pointer
val equal : t -> t -> boolequal p1 p2 returns true if pointers are equal
val compare : t -> t -> intcompare p1 p2 compares two pointers
val parse : string -> tparse s parses a JSON Pointer string. Raises Invalid_argument if invalid.
val segments : t -> string listsegments p returns the list of path segments