ULID

Members

Functions

encode
void encode(char[26] dst)

allocation free string encoding

toString
string toString()

ditto, but allocates

Static functions

fromString
ULID fromString(string str)

creates ULID from a previously string encoded ULID

generate
ULID generate()

uses std.random.uniform and core.time.MonoTime.currTime

generate
ULID generate(ulong seed)

uses std.random.uniform

generate
ULID generate(ulong seed, ubyte function() @(safe) gen)
ULID generate(ulong seed, ubyte delegate() @(safe) gen)

uses callback to set entropy

Variables

data
ubyte[16] data;

data stores ulid elements 0..6 bytes make up the time stamp 6..16 bytes make up entropy (random) part

Examples

import fluent.asserts;

ULID.generate().toString.length.should.equal(26);

//should return expected encoded time component result
ULID.generate(1469918176385).toString[0 .. 10].should.equal("01ARYZ6S41");

Meta