everyone should get free ice cream
This commit is contained in:
parent
c158f8a58c
commit
1fc481620f
14
helpers.go
14
helpers.go
|
@ -6,6 +6,7 @@ package zoopb
|
|||
import (
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/encoding/prototext"
|
||||
"google.golang.org/protobuf/proto"
|
||||
// "google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
|
@ -21,7 +22,7 @@ func (p *Packages) FormatTEXT() string {
|
|||
return prototext.Format(p)
|
||||
}
|
||||
|
||||
// marshal
|
||||
// marshal json
|
||||
func (p *Packages) MarshalJSON() ([]byte, error) {
|
||||
return protojson.Marshal(p)
|
||||
}
|
||||
|
@ -30,3 +31,14 @@ func (p *Packages) MarshalJSON() ([]byte, error) {
|
|||
func (p *Packages) UnmarshalJSON(data []byte) error {
|
||||
return protojson.Unmarshal(data, p)
|
||||
}
|
||||
|
||||
// marshal to wire
|
||||
func (p *Packages) Marshal() ([]byte, error) {
|
||||
return proto.Marshal(p)
|
||||
}
|
||||
|
||||
// unmarshal from wire
|
||||
func (p *Packages) Unmarshal(data []byte) error {
|
||||
return proto.Unmarshal(data, p)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue