diff options
| author | Jeff Carr <[email protected]> | 2024-12-01 18:18:11 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-01 18:18:11 -0600 |
| commit | e4b150d6aae34ec3f4688c09711d0bfe2bcf4b41 (patch) | |
| tree | c8283b4e2dc0a35e199343ef13f58abe77cb834f /package.marshal.go | |
| parent | a4f3f951962b2db0bb21c22c10ef60d1d57a3b5c (diff) | |
switch to autogenpbv0.0.11
Diffstat (limited to 'package.marshal.go')
| -rw-r--r-- | package.marshal.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/package.marshal.go b/package.marshal.go deleted file mode 100644 index 2c8a4e7..0000000 --- a/package.marshal.go +++ /dev/null @@ -1,42 +0,0 @@ -package zoopb - -// todo: autogen this -// functions to import and export the protobuf - -import ( - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/proto" -) - -// human readable JSON -func (p *Packages) FormatJSON() string { - return protojson.Format(p) -} - -// apparently this isn't supposed to be used? -// https://protobuf.dev/reference/go/faq/#unstable-text -// this is a shame because this is much nicer output than JSON Format() -func (p *Packages) FormatTEXT() string { - return prototext.Format(p) -} - -// marshal json -func (p *Packages) MarshalJSON() ([]byte, error) { - return protojson.Marshal(p) -} - -// unmarshal -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) -} |
