Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ICodec ¶
type ICodec interface { Encode(interface{}) ([]byte, error) Decode([]byte, interface{}) error String() string }
Codec defines the interface that decode/encode payload.
func IdentifyCodec ¶
func IdentifyCodec(st SerializeType) ICodec
type SerializeType ¶
type SerializeType byte
SerializeType defines serialization type of payload.
var Bytes SerializeType = RegisterCodec("Bytes", &byteCodec{})
Bytes only support []byte and string data type
var Gob SerializeType = RegisterCodec("Gob", newGobCodec())
var JSON SerializeType = RegisterCodec("Json", new(jsonCodec))
var MsgPack SerializeType = RegisterCodec("MsgPack", &msgpackCodec{})
var ProtoBuffer SerializeType = RegisterCodec("ProtoBuffer", &pbCodec{})
func HashName ¶
func HashName(s string) SerializeType
func RegisterCodec ¶
func RegisterCodec(name string, codec ICodec) SerializeType
RegisterCodec register customized codec.
func (SerializeType) String ¶
func (self SerializeType) String() string
Click to show internal directories.
Click to hide internal directories.