@@ -11,20 +11,20 @@ import (
1111
1212const Name = "proto"
1313
14- // vtprotoCodecV2 implements encoding.CodecV2 and uses vtproto and default buffer pool
14+ // VTProtoCodecV2 implements encoding.CodecV2 and uses vtproto and default buffer pool
1515// to encode/decode proto messages. The implementation is heavily inspired by
1616// https://github.com/planetscale/vtprotobuf/pull/138
1717// and https://github.com/vitessio/vitess/pull/16790.
18- type vtprotoCodecV2 struct {
18+ type VTProtoCodecV2 struct {
1919 fallback encoding.CodecV2
2020}
2121
22- func (vtprotoCodecV2 ) Name () string {
22+ func (VTProtoCodecV2 ) Name () string {
2323 return Name
2424}
2525
26- func (c * vtprotoCodecV2 ) Marshal (v any ) (mem.BufferSlice , error ) {
27- m , ok := v .(proto.VtprotoMessage )
26+ func (c * VTProtoCodecV2 ) Marshal (v any ) (mem.BufferSlice , error ) {
27+ m , ok := v .(proto.VTProtoMessage )
2828 if ! ok {
2929 return c .fallback .Marshal (v )
3030 }
@@ -47,8 +47,8 @@ func (c *vtprotoCodecV2) Marshal(v any) (mem.BufferSlice, error) {
4747 return mem.BufferSlice {mem .NewBuffer (buf , pool )}, nil
4848}
4949
50- func (c * vtprotoCodecV2 ) Unmarshal (data mem.BufferSlice , v any ) error {
51- m , ok := v .(proto.VtprotoMessage )
50+ func (c * VTProtoCodecV2 ) Unmarshal (data mem.BufferSlice , v any ) error {
51+ m , ok := v .(proto.VTProtoMessage )
5252 if ! ok {
5353 return c .fallback .Unmarshal (data , v )
5454 }
@@ -61,7 +61,7 @@ func (c *vtprotoCodecV2) Unmarshal(data mem.BufferSlice, v any) error {
6161// RegisterCodec registers the vtprotoCodec to encode/decode proto messages with
6262// all gRPC clients and servers.
6363func Register () {
64- encoding .RegisterCodecV2 (& vtprotoCodecV2 {
64+ encoding .RegisterCodecV2 (& VTProtoCodecV2 {
6565 fallback : encoding .GetCodecV2 ("proto" ),
6666 })
6767}
0 commit comments