Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomFormat ¶
type CustomFormat interface { // Size returns the size of the encoded element. Size() int // MarshalBinary encodes the passed value into its binary representation. MarshalBinary(v interface{}) ([]byte, error) // UnmarshalBinary decodes the passed value from its binary representation. UnmarshalBinary(v interface{}, data []byte) error }
CustomFormat specifies a custom encoding format for a key element.
func H ¶
func H(inner interface{}) CustomFormat
H wraps a key element to signal that the element should be hashed after regular encoding.
type KeyFormat ¶
type KeyFormat struct {
// contains filtered or unexported fields
}
KeyFormat is a key formatting helper to be used together with key-value backends for constructing keys.
func (*KeyFormat) Decode ¶
Decode decodes a key into its individual values.
Returns false and doesn't modify the passed values if the key prefix doesn't match.
func (*KeyFormat) Encode ¶
Encode encodes values into a key.
You can pass either the same amount of values as specified in the layout or less. In case less values are specified this will generate a shorter key containing only the specified values.
In case no values are specified this will only output the key prefix.
type PreHashed ¶
PreHashed represents a pre-hashed value that will be encoded without additional hashing when used together with a hashed format.
func (*PreHashed) MarshalBinary ¶
MarshalBinary encodes a hash into binary form.
func (*PreHashed) UnmarshalBinary ¶
UnmarshalBinary decodes a binary marshaled hash.