summaryrefslogtreecommitdiff
path: root/helpers.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-01 18:41:00 -0600
committerJeff Carr <[email protected]>2024-12-01 18:41:00 -0600
commitafd0bd642841f4dee9ca29c4913a26319aa28dd9 (patch)
tree31d55b1e4b24fb26b2927ae7f1d86364345d90dc /helpers.go
parent5b883de7b99fc15d92646a7c965fdf28f1946343 (diff)
switched to autogenpbv0.2.10
Diffstat (limited to 'helpers.go')
-rw-r--r--helpers.go68
1 files changed, 2 insertions, 66 deletions
diff --git a/helpers.go b/helpers.go
index 1533750..7d0173f 100644
--- a/helpers.go
+++ b/helpers.go
@@ -3,12 +3,6 @@ package virtbuf
// functions to import and export the protobuf
// data to and from config files
-import (
- "google.golang.org/protobuf/encoding/protojson"
- "google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/proto"
-)
-
func InitCluster() *Cluster {
var c *Cluster
c = new(Cluster)
@@ -18,64 +12,6 @@ func InitCluster() *Cluster {
return c
}
-// human readable JSON
-func (d *Droplets) FormatJSON() string {
- return protojson.Format(d)
-}
-
-func (d *Droplet) FormatJSON() string {
- return protojson.Format(d)
-}
-
-func (e *Events) FormatJSON() string {
- return protojson.Format(e)
-}
-
-func (h *Hypervisors) FormatJSON() string {
- return protojson.Format(h)
-}
-
-// 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 (d *Droplets) FormatTEXT() string {
- return prototext.Format(d)
-}
-
-func (d *Droplet) FormatTEXT() string {
- return prototext.Format(d)
-}
-
-func (e *Events) FormatTEXT() string {
- return prototext.Format(e)
-}
-
-// marshal
-func (d *Droplets) MarshalJSON() ([]byte, error) {
- return protojson.Marshal(d)
-}
-
-func (d *Droplet) MarshalJSON() ([]byte, error) {
- return protojson.Marshal(d)
-}
-
-func (e *Events) MarshalJSON() ([]byte, error) {
- return protojson.Marshal(e)
-}
-
-// unmarshal
-func (d *Droplets) UnmarshalJSON(data []byte) error {
- return protojson.Unmarshal(data, d)
-}
-
-func (d *Droplet) UnmarshalJSON(data []byte) error {
- return protojson.Unmarshal(data, d)
-}
-
-func (e *Events) UnmarshalJSON(data []byte) error {
- return protojson.Unmarshal(data, e)
-}
-
-func (d *Droplet) Unmarshal(data []byte) error {
- return proto.Unmarshal(data, d)
+func (c *Cluster) DropletsAll() *DropletIterator {
+ return c.d.All()
}