Documentation ¶
Index ¶
- Constants
- func MarshalEmpty() []byte
- func MarshalError(err error) ([]byte, error)
- func MarshalMsg(msg proto.Message) ([]byte, error)
- func RegisterGenerator(genFn func() proto.Message)
- func ToErr(msgErr error, sysErr error) error
- func ToResponse(msg proto.Message, msgErr error, sysErr error) (proto.Message, error)
- func UnmarshalEmptyRPC(data []byte) error
- func UnmarshalEmptyResponse(data []byte) (msgErr error, sysErr error)
- func UnmarshalMsg(data []byte) (msg proto.Message, err error)
- func UnmarshalRPC(data []byte) (proto.Message, error)
- func UnmarshalResponse(data []byte) (msg proto.Message, msgErr error, sysErr error)
- type FingerprintMsg
- type MsgPacker
- func (x *MsgPacker) MarshalMsg(msg proto.Message) ([]byte, error)
- func (x *MsgPacker) RegisterGenerator(genFn func() proto.Message)
- func (x *MsgPacker) UnmarshalMsg(data []byte) (msg proto.Message, err error)
- func (x *MsgPacker) UnmarshalRPC(data []byte) (proto.Message, error)
- func (x *MsgPacker) UnmarshalResponse(data []byte) (msg proto.Message, msgErr error, sysErr error)
Constants ¶
const ( // ErrMark error fingerprint ErrMark = 0 // EmptyMark emptypb.Empty fingerprint EmptyMark = 1 )
Variables ¶
This section is empty.
Functions ¶
func MarshalError ¶
MarshalError err can marshal/unmarshal, it uses a specific tag "ErrMark"
func MarshalMsg ¶
MarshalMsg marshal a protobuf message support *emptypb.Empty(it uses a specific tag "EmptyMark") and other proto message which extends "Fingerprint() uint32"
func RegisterGenerator ¶
RegisterGenerator register a protobuf generator function with tag
func ToResponse ¶ added in v0.9.8
ToResponse convert 3 params to 2 params
func UnmarshalEmptyRPC ¶ added in v0.9.8
UnmarshalEmptyRPC unmarshal to rpc response from bytes. msg -- return msg msgErr -- return error err -- unmarshal error
func UnmarshalEmptyResponse ¶ added in v0.9.8
UnmarshalEmptyResponse unmarshal to rpc response from bytes. msg -- return msg msgErr -- return error err -- unmarshal error
func UnmarshalMsg ¶ added in v0.9.8
UnmarshalMsg unmarshal a proto message from bytes. msg -- return msg err -- unmarshal error
func UnmarshalRPC ¶ added in v0.9.8
UnmarshalRPC unmarshal response to 2 params return
Types ¶
type FingerprintMsg ¶ added in v0.9.3
FingerprintMsg extends "Fingerprint() uint32" to proto message
type MsgPacker ¶
type MsgPacker struct {
// contains filtered or unexported fields
}
MsgPacker pack/unpack a protobuf message with a header tag
func (*MsgPacker) MarshalMsg ¶
MarshalMsg marshal a protobuf message support *emptypb.Empty(it uses a specific tag "EmptyMark") and other proto message which extends "Fingerprint() uint32"
func (*MsgPacker) RegisterGenerator ¶
RegisterGenerator register a protobuf generator function with tag
func (*MsgPacker) UnmarshalMsg ¶
UnmarshalMsg unmarshal a proto message from bytes. msg -- return msg err -- unmarshal error
func (*MsgPacker) UnmarshalRPC ¶ added in v0.9.8
UnmarshalRPC unmarshal response to 2 params return