From 1fc481620f5d4a8b469a02fe5ff7e12871fe309f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 15 Nov 2024 19:53:06 -0600 Subject: [PATCH] everyone should get free ice cream --- helpers.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/helpers.go b/helpers.go index 93d0a73..618bec1 100644 --- a/helpers.go +++ b/helpers.go @@ -6,6 +6,7 @@ package zoopb import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/proto" // "google.golang.org/protobuf/proto" ) @@ -21,7 +22,7 @@ func (p *Packages) FormatTEXT() string { return prototext.Format(p) } -// marshal +// marshal json func (p *Packages) MarshalJSON() ([]byte, error) { return protojson.Marshal(p) } @@ -30,3 +31,14 @@ func (p *Packages) MarshalJSON() ([]byte, error) { func (p *Packages) UnmarshalJSON(data []byte) error { return protojson.Unmarshal(data, p) } + +// marshal to wire +func (p *Packages) Marshal() ([]byte, error) { + return proto.Marshal(p) +} + +// unmarshal from wire +func (p *Packages) Unmarshal(data []byte) error { + return proto.Unmarshal(data, p) +} +