Something went wrong. Try again.
SQL frontend over the catalog engine
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142(*--------------------------------------------------------------------------- Copyright (c) 2026 Thomas Gazagnaire. All rights reserved. SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*)
(** JSONB values: the format's own data model (jsonb.html, section 3).
A value keeps what an element is, not only what it means: the text of a number as it was written, so an integer past 2{^ 53} and [1.50] stay exact, and the escapes a string was written with. A value is the escape hatch for generic work on a document; reading or editing one goes through {!Jsonb.Codec} and {!Jsonb.Cursor}, which work on the bytes. *)
(** The type for JSONB values, one constructor per element type. *)type t = | Null | True | False | Int of string (** RFC 8259 integer text, such as ["-12"]. *) | Int5 of string (** JSON5 integer text, such as ["0x1F"]. *) | Float of string (** RFC 8259 real text, such as ["1.50"]. *) | Float5 of string (** JSON5 real text, such as [".5"]. *) | Text of string (** A string with no escape. *) | Textj of string (** A string with its RFC 8259 escapes, unread. *) | Text5 of string (** A string with its JSON5 escapes, unread. *) | Textraw of string (** A string to escape on output. *) | Array of t list | Object of (t * t) list (** Labels and values in order. A label is a text element: one of {!Text}, {!Textj}, {!Text5} or {!Textraw}. *)
val sort : t -> Jsonb_sort.t(** [sort v] is the element type of [v]. *)
val equal : t -> t -> bool(** [equal a b] is [true] iff [a] and [b] are the same elements: the same types with the same payloads, so [Int "1"] and [Int5 "0x1"] differ. *)
val pp : t Fmt.t(** [pp] formats a value as JSON-like text: a number or an escaped string as its payload, a {!Textraw} string as an OCaml literal. *)