Bedrock.Encoding.None (bedrock v0.7.0)

View Source

The identity encoding: binaries in, the same binaries out.

Use it when your keys or values are already the bytes you want stored, and you want that stated explicitly rather than left to the default. A keyspace with no encoding configured behaves identically.

iex> Bedrock.Encoding.None.pack("already bytes")
"already bytes"

pack/1 accepts binaries only and raises FunctionClauseError on anything else — the encoding will not silently stringify a term for you. Being the identity, it is trivially order-preserving and therefore safe for keys.

Summary

Functions

Callback implementation for Bedrock.Encoding.pack/1.

Callback implementation for Bedrock.Encoding.unpack/1.

Functions

pack(value)

@spec pack(value :: binary()) :: binary()

Callback implementation for Bedrock.Encoding.pack/1.

unpack(packed)

@spec unpack(packed :: binary()) :: binary()

Callback implementation for Bedrock.Encoding.unpack/1.