NAME
ulid - Universally Unique Lexicographically Sortable Identifiers.
SYNOPSIS
from std/time import Time;
from ulid import create_ulid, create_ulid_binary, ulid_time;
let text := create_ulid();
let raw := create_ulid_binary();
let historical := create_ulid( time: new Time(946684800) );
let timestamp := ulid_time(text);
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
This module generates ULIDs using a 48-bit Unix timestamp in milliseconds and 80 bits of cryptographically secure randomness. The text form uses canonical uppercase Crockford Base32.
Identifiers generated within the same millisecond are monotonic: the random component is incremented so that each later identifier sorts after the previous one.
EXPORTS
Functions
create_ulid_binary(time: Time?)Parameters: optional
timesupplies the timestamp; when omitted, the current time is used. Returns:BinaryString. Returns a single ULID as 16 raw bytes in network byte order.create_ulid(time: Time?)Parameters: optional
timesupplies the timestamp; when omitted, the current time is used. Returns:String. Returns a single ULID as 26 uppercase Crockford Base32 characters.ulid_time(String|BinaryString ulid)Parameters:
ulidis a valid 26-character ULID, accepted case-insensitively, or a 16-byte binary ULID. Returns:Time. Returns the timestamp encoded in the ULID, with millisecond precision. The input form is detected automatically. Throws an exception ifulidis not valid.
COPYRIGHT AND LICENCE
ulid is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.