key

package
v0.0.0-...-40e4417 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMalformedKeyPrefix key with malformed prefix
	ErrMalformedKeyPrefix = errors.New("malformed key prefix")
)
View Source
var (
	// ErrMalformedKeySize malformed buf size for a key
	ErrMalformedKeySize = errors.New("malformed key size")
)

Functions

func Key

func Key(prefix []byte, formater Formatter) []byte

Key return a storage key of parts

func Unmarshal

func Unmarshal(key, prefix []byte, v encoding.BinaryUnmarshaler) error

Unmarshal get the content of the key

Types

type FixedFormatter

type FixedFormatter interface {
	Formatter
	encoding.BinaryUnmarshaler
	Size() int
}

FixedFormatter formarter with fixed size

type FixedFormatters

type FixedFormatters []FixedFormatter

FixedFormatters a slice of formaters

func (FixedFormatters) Bytes

func (f FixedFormatters) Bytes() []byte

Bytes implement Formater

func (FixedFormatters) UnmarshalBinary

func (f FixedFormatters) UnmarshalBinary(buf []byte) error

UnmarshalBinary implement encoding.BinaryUnmarshaler

type Formatter

type Formatter interface {
	Bytes() []byte
}

Formatter the content part of a storage key

type I32

type I32 int32

I32 key formatter wrapper of int32

func (I32) Bytes

func (i I32) Bytes() []byte

Bytes return bytes

func (I32) Size

func (I32) Size() int

Size implement FixedFormater

func (*I32) UnmarshalBinary

func (i *I32) UnmarshalBinary(buf []byte) error

UnmarshalBinary get int32 from bytes

type I64

type I64 int64

I64 key formatter wrapper of int64

func (I64) Bytes

func (i I64) Bytes() []byte

Bytes return bytes

func (I64) Size

func (I64) Size() int

Size implement FixedFormater

func (*I64) UnmarshalBinary

func (i *I64) UnmarshalBinary(buf []byte) error

UnmarshalBinary get int64 from bytes

type UI32

type UI32 uint32

UI32 key formatter wrapper of uint32

func (UI32) Bytes

func (u UI32) Bytes() []byte

Bytes return bytes

func (UI32) Size

func (UI32) Size() int

Size implement FixedFormater

func (*UI32) UnmarshalBinary

func (u *UI32) UnmarshalBinary(buf []byte) error

UnmarshalBinary get uint32 from bytes

type UI64

type UI64 uint64

UI64 key formatter wrapper of uint64

func (UI64) Bytes

func (u UI64) Bytes() []byte

Bytes return bytes

func (UI64) Size

func (UI64) Size() int

Size implement FixedFormater

func (*UI64) UnmarshalBinary

func (u *UI64) UnmarshalBinary(buf []byte) error

UnmarshalBinary get uint64 from bytes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL