createReverseTimestampId
createReverseTimestampId<
Brand>(brand,opts?):ReverseTimestampCodec<Brand>
Defined in: src/codecs/reverse/index.ts:135
Creates a Reverse Timestamp codec for brand (three lowercase a–z characters).
IDs sort newest-first: the 48-bit timestamp field is bitwise-inverted before encoding,
so lexicographic ID order equals descending creation-time order. extractTimestamp
inverts back to recover the original millisecond.
Type Parameters
Section titled “Type Parameters”Brand extends string
Parameters
Section titled “Parameters”Brand & ValidBrand<Brand>
Entity type brand validated once at construction.
Optional now, rng, and allowDuplicateBrand overrides.
Returns
Section titled “Returns”ReverseTimestampCodec<Brand>
Example
Section titled “Example”const posts = createReverseTimestampId("pst");
const id = posts.generate(); // Id<"pst"> (newest-first sort)posts.extractTimestamp(id); // Date