SQL frontend over the catalog engine
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Thomas Gazagnaire. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** SQLite date and time functions (lang_datefunc.html).
7
8 Time is carried internally as a Julian Day count in integer milliseconds,
9 exactly as sqlite3 does, so the deterministic surface -- explicit time
10 strings, Julian and unix numbers, the unit and "start of" modifiers -- is
11 exact and round-trips. The wall-clock forms ('now', 'localtime', 'utc')
12 yield NULL until a clock is injected. *)
13
14val call : string -> Ast.value list -> Ast.value
15(** [call name args] evaluates the date/time function [name] (one of ["date"],
16 ["time"], ["datetime"], ["julianday"], ["unixepoch"], ["strftime"]) on
17 [args]: the first argument (after the format string for [strftime]) is the
18 time value and the rest are modifiers. An unparseable value, out-of-range
19 field, or unknown modifier yields [Null], as in sqlite3.
20
21 @raise Invalid_argument if [name] is not a date/time function. *)