Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct { // Protobuf should pass through to Google Protobuf in production paths Protobuf Protobuf }
Dispatcher is used to handle the boilerplate proto tasks of unmarshaling inputs and remarshaling outputs so that the receiver may focus on the implementation details rather than the proto hassles.
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(inputBytes []byte, methodName string, receiver interface{}) ([]byte, error)
Dispatch deserializes the input bytes to the correct type for the method in the receiver, then if successful, marshals the output message to bytes and returns it. On error, it simply returns the error. The method on the receiver must take a single parameter which is a concrete proto message type and it should return a proto message and error.
type Protobuf ¶
type Protobuf interface { Marshal(msg proto.Message) (marshaled []byte, err error) Unmarshal(marshaled []byte, msg proto.Message) error }
Protobuf defines the subset of protobuf lifecycle needs and allows for injection of mocked marshaling errors.
type ProtobufImpl ¶
type ProtobufImpl struct{}
ProtobufImpl is the standard implementation to use for Protobuf