Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeAny(tc TypeCodec, to *TypedObj) (interface{}, error)
- 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 DecodeSelfer
- type Decoder
- type EncodeSelfer
- type Encoder
- type Marshaler
- type Reader
- type Selfer
- type SimpleDecoder
- type SimpleEncoder
- type TypeCodec
- type TypedObj
- type Unmarshaler
- type Writer
Constants ¶
View Source
const ( TypeNil uint8 = iota TypeDict TypeList TypeBytes TypeString TypeBool TypeCustom = 10 )
Variables ¶
View Source
var ( ErrNilValue = errors.New("NilValueError") ErrInvalidFormat = errors.New("InvalidFormatError") ErrIllegalType = errors.New("IllegalTypeError") )
View Source
var ( TrueBytes = []byte{0x01} FalseBytes = []byte{0x00} )
View Source
var (
BC = RLP
)
View Source
var JSON = bytesWrapper{&jsonCodecObject}
View Source
var MP = bytesWrapper{&mpCodecObject}
View Source
var Nil = &TypedObj{ typedObjBase{ TypeNil, nil, }, }
View Source
var RLP = bytesWrapper{&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) SimpleEncoder // contains filtered or unexported methods }
type DecodeSelfer ¶
type Decoder ¶
type Decoder interface { Decode(o interface{}) error DecodeMulti(objs ...interface{}) (int, error) DecodeBytes() ([]byte, error) DecodeList() (Decoder, error) DecodeListOf(objs ...interface{}) error }
func NewDecoder ¶
type EncodeSelfer ¶
type Encoder ¶
type Encoder interface { Encode(o interface{}) error EncodeMulti(objs ...interface{}) error EncodeList() (Encoder, error) EncodeListOf(objs ...interface{}) error }
func NewEncoder ¶
type Selfer ¶
type Selfer interface { EncodeSelfer DecodeSelfer }
type SimpleDecoder ¶
type SimpleDecoder interface {
Decode(v interface{}) error
}
func NewSimpleDecoder ¶
func NewSimpleDecoder(r io.Reader) SimpleDecoder
type SimpleEncoder ¶
type SimpleEncoder interface {
Encode(v interface{}) error
}
func NewEncoderBytes ¶
func NewEncoderBytes(b *[]byte) SimpleEncoder
func NewSimpleEncoder ¶
func NewSimpleEncoder(w io.Writer) SimpleEncoder
type TypedObj ¶
type TypedObj struct {
// contains filtered or unexported fields
}
func (*TypedObj) RLPDecodeSelf ¶
func (*TypedObj) RLPEncodeSelf ¶
type Unmarshaler ¶
Click to show internal directories.
Click to hide internal directories.