diff options
Diffstat (limited to 'helpers.go')
| -rw-r--r-- | helpers.go | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,8 +1,10 @@ package virtbuf -import "fmt" import ( - "google.golang.org/protobuf/encoding/protojson" + "fmt" + + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/encoding/prototext" ) func (x *Hypervisor) SetMemoryGB(gb int) { @@ -14,11 +16,18 @@ func (x *Hypervisor) GetMemoryPrintable() string { return fmt.Sprintf("%d GB", i) } - func (c *Cluster) MarshalJSON() ([]byte, error) { - return protojson.Marshal(c) + return protojson.Marshal(c) +} + +func (c *Cluster) FormatJSON() string { + return protojson.Format(c) +} + +func (c *Cluster) FormatTEXT() string { + return prototext.Format(c) } func (c *Cluster) UnmarshalJSON(data []byte) error { - return protojson.Unmarshal(data, c) + return protojson.Unmarshal(data, c) } |
