Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f80fd3

Browse files
authored
Make SdkToProto and ProtoToSDK public (#758)
* Make SdkToProto and ProtoToSDK public Signed-off-by: Kevin Su <[email protected]> * Fixed tests Signed-off-by: Kevin Su <[email protected]>
1 parent 7601392 commit 9f80fd3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

binding/format/protobuf/v2/protobuf.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (protobufFmt) MediaType() string {
5656
}
5757

5858
func (protobufFmt) Marshal(e *event.Event) ([]byte, error) {
59-
pbe, err := sdkToProto(e)
59+
pbe, err := ToProto(e)
6060
if err != nil {
6161
return nil, err
6262
}
@@ -67,7 +67,7 @@ func (protobufFmt) Unmarshal(b []byte, e *event.Event) error {
6767
if err := proto.Unmarshal(b, pbe); err != nil {
6868
return err
6969
}
70-
e2, err := protoToSDK(pbe)
70+
e2, err := FromProto(pbe)
7171
if err != nil {
7272
return err
7373
}
@@ -76,7 +76,7 @@ func (protobufFmt) Unmarshal(b []byte, e *event.Event) error {
7676
}
7777

7878
// convert an SDK event to a protobuf variant of the event that can be marshaled.
79-
func sdkToProto(e *event.Event) (*pb.CloudEvent, error) {
79+
func ToProto(e *event.Event) (*pb.CloudEvent, error) {
8080
container := &pb.CloudEvent{
8181
Id: e.ID(),
8282
Source: e.Source(),
@@ -191,7 +191,7 @@ func valueFrom(attr *pb.CloudEventAttributeValue) (interface{}, error) {
191191
}
192192

193193
// Convert from a protobuf variant into the generic, SDK event.
194-
func protoToSDK(container *pb.CloudEvent) (*event.Event, error) {
194+
func FromProto(container *pb.CloudEvent) (*event.Event, error) {
195195
e := event.New()
196196
e.SetID(container.Id)
197197
e.SetSource(container.Source)

0 commit comments

Comments
 (0)