Home

Awesome

OCaml TypeId

An OCaml, following the specs, implementation of TypeId. Also provide a implementation of UUIDv7

Usage:

let () =
  Random.self_init ();
  let id = Typeid.make "myprefix" in
  let id_str = Typeid.to_string id in
  Printf.printf "%s" id_str;
  match Typeid.from_string_option id_str with
    | Some x -> (* my typeid *)
    | None -> failWith "Can't parse typeid"

[!NOTE] UuidV7 uses random bits so, you need to initialize the random pseudo generator yourself.