Fractional indexing for ordered sequences.
Generates lexicographically-sortable binary strings using base-62 digits (0-9, A-Z, a-z in ASCII order). A new key can always be generated between any two existing keys, making this suitable for maintaining ordered lists in key-value stores without reindexing.
Summary
Functions
Returns a key that sorts after Key.
Returns a key that sorts before Key.
Returns a key that sorts between A and B. Requires A < B.
Returns the midpoint key of the full keyspace.
Returns N evenly-spaced keys between A and B. Use <<>> for unbounded start/end.
Returns N evenly-spaced keys across the full keyspace.
Types
-type key() :: binary().
Functions
Returns a key that sorts after Key.
Returns a key that sorts before Key.
Returns a key that sorts between A and B. Requires A < B.
-spec first() -> key().
Returns the midpoint key of the full keyspace.
-spec n_between(binary(), binary(), non_neg_integer()) -> [key()].
Returns N evenly-spaced keys between A and B. Use <<>> for unbounded start/end.
-spec n_first(pos_integer()) -> [key()].
Returns N evenly-spaced keys across the full keyspace.