message

package
v1.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalJSON

func MarshalJSON(m Message) ([]byte, error)

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

type GRPCConvertedMessage interface {
	grpc.Message
	proto.Message
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL