Documentation ¶
Overview ¶
Package codec is the registration center for supported codecs you can register whatever codec implementation you want
e.g. for json codec, you can register you own codec implementation based on other json library (other than encoding/json)
by default, using encoding/json for json codec and gogoproto for protobuf codec
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBytesBuf ¶ added in v0.4.4
func PutBytesBuf ¶ added in v0.4.4
func PutBytesBuf(b *[]byte)
Types ¶
type Decoder ¶ added in v0.4.4
type Decoder interface { // Decode one message from stream Decode(out interface{}) error }
Decoder for stream data decoding
type Encoder ¶ added in v0.4.4
type Encoder interface { // Encode one message to stream Encode(any interface{}) error }
Encoder for stream data encoding
type Interface ¶ added in v0.4.4
type Interface interface { // Type is the codec kind Type() arhatgopb.CodecType // NewEncoder creates a new Encoder which will encode messages to the Writer NewEncoder(w io.Writer) Encoder // NewEncoder creates a new Decoder which will decode messages from the Reader NewDecoder(r io.Reader) Decoder // Unmarshal non stream data Unmarshal(data []byte, out interface{}) error // Marshal v as non stream data Marshal(v interface{}) ([]byte, error) }
Interface of codec knows how to encode/decode all kinds of data, including stream data
type MarshalFunc ¶ added in v0.4.4
type UnmarshalFunc ¶ added in v0.4.4
Directories ¶
Path | Synopsis |
---|---|
Package codecpb implements protobuf codec for libext
|
Package codecpb implements protobuf codec for libext |
Package codecjson uses stdlib json for libext
|
Package codecjson uses stdlib json for libext |
Click to show internal directories.
Click to hide internal directories.