type t = string exception Invalid of string let is_valid : string -> bool = fun id -> id <> "" && String.for_all (fun c -> (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c = '_' || c = '-') id let of_string_opt : string -> t option = fun id -> if is_valid id then Some id else None let of_string : string -> t = fun id -> match of_string_opt id with Some id -> id | None -> raise (Invalid id) let to_string : t -> string = fun id -> id (** The fixed columns of the generated schema, predefined so that the SQL generation can refer to them directly. *) let id : t = of_string "id" let parent : t = of_string "parent" let target : t = of_string "target" let quote : t -> string = fun id -> "\"" ^ id ^ "\"" let dot : t -> t -> t = fun a b -> a ^ "." ^ b let equal : t -> t -> bool = String.equal let compare : t -> t -> int = String.compare let hash : t -> int = Hashtbl.hash let pp : Format.formatter -> t -> unit = Format.pp_print_string