Documentation ¶
Overview ¶
Package hexkey implements utilities for hexadecimal encoding of blob store keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotMyKey = errors.New("key does not match config")
ErrNotMyKey is a sentinel error reported by Decode when given a key that does not match the parameters of the config.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Prefix, if set, is prepended to all keys, separated from the remainder of // the key by "/". Prefix string // Shard, if positive, specifies a prefix length for each hex-encoded key, // that will be separated from the key by an intervening "/". // For example, if Shard is 2, a key "012345" becomes "01/012345". // If Shard ≤ 0, keys are not partitioned. Shard int }
Config carries settings for the encoding and decoding of hex keys. The zero value is ready for use and encodes keys as plain hexadecimal strings.
func (Config) Decode ¶
Decode decodes the specified hex-encoded key according to c. If ekey does not match the expected format, it reports ErrNotMyKey. Otherwise, any error results from decoding the hexadecimal digits.
func (Config) WithPrefix ¶ added in v0.8.0
WithPrefix returns a copy of c with its prefix set to pfx.
Click to show internal directories.
Click to hide internal directories.