Documentation ¶
Index ¶
- Constants
- func DisableKeyNameTracking()
- func EnableKeyNameTracking()
- func ReadBinary[V any](v *V, read func(uint) (V, bool))
- type Key
- func (k *Key) Append(v ...any) *Key
- func (k *Key) AppendKey(l *Key) *Key
- func (k *Key) Compare(l *Key) int
- func (k *Key) Copy() *Key
- func (k *Key) CopyAsInterface() any
- func (k *Key) Equal(l *Key) bool
- func (k *Key) Get(i int) any
- func (k *Key) Hash() KeyHash
- func (k *Key) Len() int
- func (k *Key) MarshalBinary() ([]byte, error)
- func (k *Key) MarshalJSON() ([]byte, error)
- func (k *Key) SliceI(i int) *Key
- func (k *Key) SliceJ(j int) *Key
- func (k *Key) String() string
- func (k *Key) Stringf(format string) string
- func (k *Key) UnmarshalBinary(b []byte) error
- func (k *Key) UnmarshalBinaryFrom(rd io.Reader) error
- func (k *Key) UnmarshalJSON(b []byte) error
- type KeyHash
Constants ¶
const KeyHashLength = 32
Variables ¶
This section is empty.
Functions ¶
func DisableKeyNameTracking ¶ added in v1.1.1
func DisableKeyNameTracking()
func EnableKeyNameTracking ¶ added in v1.1.1
func EnableKeyNameTracking()
func ReadBinary ¶
Types ¶
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
A Key is the key for a record.
func (*Key) AppendKey ¶ added in v1.1.1
AppendKey appends one key to another. AppendKey will panic if K is not empty and L starts with a precomputed KeyHash.
func (*Key) Compare ¶ added in v1.1.1
Compare compares two keys. Compare may panic if either key has an unexpected value type.
func (*Key) CopyAsInterface ¶
CopyAsInterface implements encoding.BinaryValue.
func (*Key) MarshalBinary ¶
MarshalBinary marshals the key to bytes.
func (*Key) MarshalJSON ¶
MarshalJSON marshals the key to JSON.
The key is marshaled as an list of single item objects where the key is the type code and the value is the value. For example:
[{"string": "Account"}, {"url": "foo.acme"}, {"string": "MainChain"}, {"string": "Element"}, {"int": 1}]
func (*Key) UnmarshalBinary ¶
UnmarshalBinary unmarshals a key from bytes.
func (*Key) UnmarshalBinaryFrom ¶
UnmarshalBinaryFrom unmarshals a key from bytes.
func (*Key) UnmarshalJSON ¶
UnmarshalJSON unmarshals a key from JSON.
See Key.MarshalJSON for the format and an example.
type KeyHash ¶ added in v1.1.1
type KeyHash [KeyHashLength]byte
func (KeyHash) MarshalJSON ¶ added in v1.1.1
MarshalJSON is implemented for JSON-based logging