Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalJSON ¶
MarshalJSON encodes m to Protobuf JSON representation.
func Unmarshal ¶
func Unmarshal(m Message, data []byte, gm GRPCConvertedMessage) error
Unmarshal decodes m from its Protobuf binary representation via related gRPC message.
gm should be tof the same type as the m.ToGRPCMessage() return.
func UnmarshalJSON ¶
func UnmarshalJSON(m Message, data []byte, gm GRPCConvertedMessage) error
UnmarshalJSON decodes m from its Protobuf JSON representation via related gRPC message.
gm should be tof the same type as the m.ToGRPCMessage() return.
Types ¶
type ErrUnexpectedMessageType ¶
type ErrUnexpectedMessageType struct {
// contains filtered or unexported fields
}
ErrUnexpectedMessageType is an error that is used to indicate message mismatch.
func NewUnexpectedMessageType ¶
func NewUnexpectedMessageType(act, exp interface{}) ErrUnexpectedMessageType
NewUnexpectedMessageType initializes an error about message mismatch between act and exp.
func (ErrUnexpectedMessageType) Error ¶
func (e ErrUnexpectedMessageType) Error() string
type GRPCConvertedMessage ¶
GRPCConvertedMessage is an interface of the gRPC message that is used for Message encoding/decoding.
type Message ¶
type Message interface {
// Must return gRPC message that can
// be used for gRPC protocol transmission.
ToGRPCMessage() grpc.Message
// Must restore the message from related
// gRPC message.
//
// If gRPC message is not a related one,
// ErrUnexpectedMessageType can be returned
// to indicate this.
FromGRPCMessage(grpc.Message) error
}
Message represents raw Protobuf message that can be transmitted via several transport protocols.