{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v2.0.0-alpha+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package dispatcher\n\n## Types\n\n```go\ntype Dispatcher struct {\n\t// Protobuf should pass through to Google Protobuf in production paths\n\tProtobuf Protobuf\n}\n```\nDispatcher 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.\n\n```go\nfunc (d *Dispatcher) Dispatch(inputBytes []byte, methodName string, receiver interface{}) ([]byte, error)\n```\nDispatch 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.\n\n```go\ntype Protobuf interface {\n\tMarshal(msg proto.Message) (marshaled []byte, err error)\n\tUnmarshal(marshaled []byte, msg proto.Message) error\n}\n```\nProtobuf defines the subset of protobuf lifecycle needs and allows for injection of mocked marshaling errors.\n\n```go\ntype ProtobufImpl struct{}\n```\nProtobufImpl is the standard implementation to use for Protobuf\n\n```go\nfunc (p ProtobufImpl) Marshal(msg proto.Message) ([]byte, error)\n```\nMarshal passes through to proto.Marshal\n\n```go\nfunc (p ProtobufImpl) Unmarshal(marshaled []byte, msg proto.Message) error\n```\nUnmarshal passes through to proto.Unmarshal\n\n","path":"github.com/eric-erki/https-hyperledger.org/core/dispatcher","name":"dispatcher","synopsis":"","isRedistributable":true}
