Wrap ProtoCodec in interface (#7637)

* WIP encoding change

* Add test that describes issue

* WIP debugging

* remove extra code

* Update codec/proto_codec.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
This commit is contained in:
Jack Zampolin
2020-10-27 13:53:54 +00:00
committed by GitHub
co-authored by colin axnér
parent 48c72230f0
commit 9befc6ced8
5 changed files with 14 additions and 6 deletions
+8
View File
@@ -11,6 +11,13 @@ import (
"github.com/gogo/protobuf/proto"
)
// ProtoCodecMarshaler defines an interface for codecs that utilize Protobuf for both
// binary and JSON encoding.
type ProtoCodecMarshaler interface {
Marshaler
InterfaceRegistry() types.InterfaceRegistry
}
// ProtoCodec defines a codec that utilizes Protobuf for both binary and JSON
// encoding.
type ProtoCodec struct {
@@ -18,6 +25,7 @@ type ProtoCodec struct {
}
var _ Marshaler = &ProtoCodec{}
var _ ProtoCodecMarshaler = &ProtoCodec{}
// NewProtoCodec returns a reference to a new ProtoCodec
func NewProtoCodec(interfaceRegistry types.InterfaceRegistry) *ProtoCodec {