(*--------------------------------------------------------------------------- Copyright (c) 2026 Thomas Gazagnaire. All rights reserved. SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*) type t = { collation : Collation.t; desc : bool } let v ?(desc = false) collation = { collation; desc } let default = { collation = Collation.default; desc = false } let pp ppf o = Fmt.string ppf (Collation.to_string o.collation); if o.desc then Fmt.string ppf " DESC" let equal a b = Collation.equal a.collation b.collation && a.desc = b.desc let orient o c = if o.desc then -c else c let compare_text o x y = orient o (Collation.compare_text o.collation x y) let compare_sub o a aoff alen b boff blen = orient o (Collation.compare_sub o.collation a aoff alen b boff blen)