diff options
| author | Jeff Carr <[email protected]> | 2024-11-27 21:41:57 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-27 21:41:57 -0600 |
| commit | 1321787a3b4c92ee9c9ac5c21a0c511c1c2eaff5 (patch) | |
| tree | 0ae8279368fae97b74935f7573f4f518ae67adbd /repo.marshal.go | |
| parent | ed3eacfe75e479e8c36cf7ba82a431c567f83602 (diff) | |
rename. always use plural form for proto files?
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'repo.marshal.go')
| -rw-r--r-- | repo.marshal.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/repo.marshal.go b/repo.marshal.go deleted file mode 100644 index 738ae35..0000000 --- a/repo.marshal.go +++ /dev/null @@ -1,42 +0,0 @@ -package gitpb - -// 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 (r *Repo) FormatJSON() string { - return protojson.Format(r) -} - -// 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 (r *Repo) FormatTEXT() string { - return prototext.Format(r) -} - -// marshal json -func (r *Repo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(r) -} - -// unmarshal -func (r *Repo) UnmarshalJSON(data []byte) error { - return protojson.Unmarshal(data, r) -} - -// marshal to wire -func (r *Repo) Marshal() ([]byte, error) { - return proto.Marshal(r) -} - -// unmarshal from wire -func (r *Repo) Unmarshal(data []byte) error { - return proto.Unmarshal(data, r) -} |
