update codec to allow reuse buffers

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-09-16 23:44:26 +03:00
parent e0ae6cf5ff
commit d466a05b9d
5 changed files with 151 additions and 83 deletions

18
options.go Normal file
View File

@@ -0,0 +1,18 @@
package proto
import (
codec "go.unistack.org/micro/v3/codec"
"google.golang.org/protobuf/proto"
)
type unmarshalOptionsKey struct{}
func UnmarshalOptions(o proto.UnmarshalOptions) codec.Option {
return codec.SetOption(unmarshalOptionsKey{}, o)
}
type marshalOptionsKey struct{}
func MarshalOptions(o proto.MarshalOptions) codec.Option {
return codec.SetOption(marshalOptionsKey{}, o)
}