File tree 1 file changed +31
-0
lines changed 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2023 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // Package protoadapt bridges the original and new proto APIs.
6
+ package protoadapt
7
+
8
+ import (
9
+ "google.golang.org/protobuf/proto"
10
+ "google.golang.org/protobuf/runtime/protoiface"
11
+ "google.golang.org/protobuf/runtime/protoimpl"
12
+ )
13
+
14
+ // MessageV1 is the original "github.com/golang/protobuf/proto".Message type.
15
+ type MessageV1 = protoiface.MessageV1
16
+
17
+ // MessageV2 is the Message type used by the current google.golang.org/protobuf
18
+ // module, adding support for reflection.
19
+ type MessageV2 = proto.Message
20
+
21
+ // MessageV1Of converts a v2 message to a v1 message.
22
+ // It returns nil if m is nil.
23
+ func MessageV1Of (m MessageV2 ) protoiface.MessageV1 {
24
+ return protoimpl .X .ProtoMessageV1Of (m )
25
+ }
26
+
27
+ // MessageV2Of converts a v1 message to a v2 message.
28
+ // It returns nil if m is nil.
29
+ func MessageV2Of (m MessageV1 ) proto.Message {
30
+ return protoimpl .X .ProtoMessageV2Of (m )
31
+ }
You can’t perform that action at this time.
0 commit comments