40 lines
789 B
Go
40 lines
789 B
Go
|
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)
|
||
|
}
|