From fdedbb40e95bb8fb3e065ad32c2e626c61cd7690 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 20 Jan 2025 08:21:38 -0600 Subject: [PATCH] Notes added by 'git notes append' --- 91602683263cf9bdde1faaad22ba46b4f006a562 | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/91602683263cf9bdde1faaad22ba46b4f006a562 b/91602683263cf9bdde1faaad22ba46b4f006a562 index 7345219..db199d8 100644 --- a/91602683263cf9bdde1faaad22ba46b4f006a562 +++ b/91602683263cf9bdde1faaad22ba46b4f006a562 @@ -1215,3 +1215,61 @@ func (all *Droplets) selectAllDroplet() []*Droplet { } // `autogen:event.marshal.pb.go` + +package virtbuf + +// This file was autogenerated with autogenpb. +// go install go.wit.com/apps/autogenpb@latest +// +// You can use it on simple protobuf files +// The .proto file must have a singular and plural form of a message +// (for those of you that know ruby on rails, it's like that) +// +// You can mark which repos you want to auto generate sort.pb.go and marshal.pb.go files for +// +// For an example, +// go-clone go.wit.com/lib/protobuf/gitpb +// + +import ( + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/proto" +) + +// human readable JSON +func (v *Events) FormatJSON() string { + return protojson.Format(v) +} + +// marshal json +func (v *Events) MarshalJSON() ([]byte, error) { + return protojson.Marshal(v) +} + +// unmarshal json +func (v *Events) UnmarshalJSON(data []byte) error { + return protojson.Unmarshal(data, v) +} + +// apparently this isn't stable, but it's awesomely better +// https://protobuf.dev/reference/go/faq/#unstable-text +// it's so great for config files, I'm using it by default to try to fix the problems with it +func (v *Events) FormatTEXT() string { + return prototext.Format(v) +} + +// unmarshalTEXT. This reads the .text config file back in after the user edits it +func (v *Events) UnmarshalTEXT(data []byte) error { + return prototext.Unmarshal(data, v) +} + +// marshal to wire. This is called winning. +func (v *Events) Marshal() ([]byte, error) { + return proto.Marshal(v) +} + +// unmarshal from wire. You have won. +func (v *Events) Unmarshal(data []byte) error { + return proto.Unmarshal(data, v) +}