Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeAny(tc TypeCodec, to *TypedObj) (interface{}, error)
- func LimitReader(r io.Reader, n int64) io.Reader
- func Marshal(w io.Writer, v interface{}) error
- func MarshalAny(c Codec, tc TypeCodec, o interface{}) ([]byte, error)
- func MarshalToBytes(v interface{}) ([]byte, error)
- func MustMarshalToBytes(v interface{}) []byte
- func MustUnmarshalFromBytes(b []byte, v interface{}) []byte
- func Unmarshal(r io.Reader, v interface{}) error
- func UnmarshalAny(c Codec, tc TypeCodec, bs []byte) (interface{}, error)
- func UnmarshalFromBytes(b []byte, v interface{}) ([]byte, error)
- type Codec
- type DecodeAndCloser
- type DecodeSelfer
- type Decoder
- type EncodeAndCloser
- type EncodeSelfer
- type Encoder
- type Marshaler
- type ReadSelfer
- type Reader
- type Selfer
- type TypeCodec
- type TypedDict
- type TypedObj
- type Unmarshaler
- type WriteSelfer
- type Writer
Constants ¶
View Source
const ( TypeNil uint8 = iota TypeDict TypeList TypeBytes TypeString TypeBool TypeCustom = 10 )
View Source
const MaxSizeForBytes = 1e6
MaxSizeForBytes is size limit for bytes buffer. msgpack decoder already has limit to 1 MB
Variables ¶
View Source
var ( ErrNilValue = errors.New("NilValueError") ErrInvalidFormat = errors.New("InvalidFormatError") ErrIllegalType = errors.New("IllegalTypeError") ErrPanicInCustom = errors.New("PanicInCustomError") )
View Source
var ( TrueBytes = []byte{0x01} FalseBytes = []byte{0x00} )
View Source
var (
BC = RLP
)
View Source
var MP = bytesWrapperFrom(&mpCodecObject)
View Source
var Nil = &TypedObj{ typedObjBase{ TypeNil, nil, }, }
View Source
var RLP = bytesWrapperFrom(&rlpCodecObject)
Functions ¶
func MarshalToBytes ¶
func MustMarshalToBytes ¶
func MustMarshalToBytes(v interface{}) []byte
func MustUnmarshalFromBytes ¶
func UnmarshalFromBytes ¶
Types ¶
type Codec ¶
type Codec interface { Marshal(w io.Writer, v interface{}) error Unmarshal(r io.Reader, v interface{}) error MarshalToBytes(v interface{}) ([]byte, error) UnmarshalFromBytes(b []byte, v interface{}) ([]byte, error) MustMarshalToBytes(v interface{}) []byte MustUnmarshalFromBytes(b []byte, v interface{}) []byte NewEncoderBytes(b *[]byte) EncodeAndCloser // contains filtered or unexported methods }
type DecodeAndCloser ¶ added in v0.9.6
func NewDecoder ¶
func NewDecoder(r Reader) DecodeAndCloser
func NewSimpleDecoder ¶
func NewSimpleDecoder(r io.Reader) DecodeAndCloser
type DecodeSelfer ¶
type EncodeAndCloser ¶ added in v0.9.6
func NewEncoder ¶
func NewEncoder(w Writer) EncodeAndCloser
func NewEncoderBytes ¶
func NewEncoderBytes(b *[]byte) EncodeAndCloser
func NewSimpleEncoder ¶
func NewSimpleEncoder(w io.Writer) EncodeAndCloser
type EncodeSelfer ¶
type ReadSelfer ¶ added in v0.9.6
type Selfer ¶
type Selfer interface { EncodeSelfer DecodeSelfer }
type TypedDict ¶ added in v0.9.6
func (*TypedDict) RLPReadSelf ¶ added in v0.9.6
func (*TypedDict) RLPWriteSelf ¶ added in v0.9.6
type TypedObj ¶
type TypedObj struct {
// contains filtered or unexported fields
}
func (*TypedObj) RLPDecodeSelf ¶
func (*TypedObj) RLPEncodeSelf ¶
type Unmarshaler ¶
type WriteSelfer ¶ added in v0.9.6
Click to show internal directories.
Click to hide internal directories.