prepare to autogen these files

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-21 19:00:08 -06:00
parent 5581a4eb9c
commit 1f0a18a0a8
4 changed files with 40 additions and 22 deletions

39
machine.marshal.go Normal file
View File

@ -0,0 +1,39 @@
package zoopb
// todo: autogen this
import (
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"
)
// marshal to wire
func (m *Machine) Marshal() ([]byte, error) {
return proto.Marshal(m)
}
// marshal to TEXT
func (m *Machine) MarshalTEXT() ([]byte, error) {
return prototext.Marshal(m)
}
// marshal to JSON
func (m *Machine) MarshalJSON() ([]byte, error) {
return protojson.Marshal(m)
}
// unmarshal from wire
func (m *Machine) Unmarshal(data []byte) error {
return proto.Unmarshal(data, m)
}
// marshal to wire
func (m *Machines) Marshal() ([]byte, error) {
return proto.Marshal(m)
}
// unmarshal from wire
func (m *Machines) Unmarshal(data []byte) error {
return proto.Unmarshal(data, m)
}

View File

@ -1,13 +1,12 @@
package zoopb package zoopb
// todo: autogen this
// functions to import and export the protobuf // functions to import and export the protobuf
// data to and from config files
import ( import (
"google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
// "google.golang.org/protobuf/proto"
) )
// human readable JSON // human readable JSON
@ -41,23 +40,3 @@ func (p *Packages) Marshal() ([]byte, error) {
func (p *Packages) Unmarshal(data []byte) error { func (p *Packages) Unmarshal(data []byte) error {
return proto.Unmarshal(data, p) return proto.Unmarshal(data, p)
} }
// marshal to wire
func (m *Machine) Marshal() ([]byte, error) {
return proto.Marshal(m)
}
// unmarshal from wire
func (m *Machine) Unmarshal(data []byte) error {
return proto.Unmarshal(data, m)
}
// marshal to wire
func (m *Machines) Marshal() ([]byte, error) {
return proto.Marshal(m)
}
// unmarshal from wire
func (m *Machines) Unmarshal(data []byte) error {
return proto.Unmarshal(data, m)
}