Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 673 Bytes

Readme.md

File metadata and controls

22 lines (15 loc) · 673 Bytes

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.