barrel_design_key (barrel_design v0.1.0)

View Source

Order-preserving view keys (encoding version 1).

A key is null, false, true, a signed 64-bit integer, a UTF-8 text or an array of keys. Encoded keys compare as bytes in this order: null, false, true, integers (numeric), texts (UTF-8 byte order), then arrays (element by element, a shorter prefix first). Each value is self-delimiting, so an array prefix such as [<<"Ada">>] selects exactly the keys whose first component is <<"Ada">>.

Texts sort by their UTF-8 bytes, which is code point order, not a locale collation.

Summary

Functions

The smallest binary greater than every binary starting with Prefix (an exclusive upper bound for a prefix scan).

The bytes every key whose leading array components equal Components starts with.

The bytes every encoded text starting with Stem starts with.

True when Term is an encodable key: UTF-8 texts, 64-bit integers, booleans, null and arrays of those nested at most 4 deep.

Types

key/0

-type key() :: null | boolean() | integer() | binary() | [key()].

Functions

after_prefix(Prefix)

-spec after_prefix(binary()) -> binary().

The smallest binary greater than every binary starting with Prefix (an exclusive upper bound for a prefix scan).

decode(Bin)

-spec decode(binary()) -> key().

encode(I)

-spec encode(key()) -> binary().

prefix(Components)

-spec prefix([key()]) -> binary().

The bytes every key whose leading array components equal Components starts with.

text_prefix(Stem)

-spec text_prefix(binary()) -> binary().

The bytes every encoded text starting with Stem starts with.

valid(Term)

-spec valid(term()) -> boolean().

True when Term is an encodable key: UTF-8 texts, 64-bit integers, booleans, null and arrays of those nested at most 4 deep.

version()

-spec version() -> pos_integer().