type AnyResolver interface {
Resolve(typeURL string) (proto.Message, error)
}
type JSONPBMarshaler interface {
MarshalJSONPB(*Marshaler) ([]byte, error)
}
https://developers.google.com/protocol-buffers/docs/proto3#json
type JSONPBUnmarshaler interface {
UnmarshalJSONPB(*Unmarshaler, []byte) error
}
https://developers.google.com/protocol-buffers/docs/proto3#json
type Marshaler struct {
// OrigName specifies whether to use the original protobuf name for fields.
OrigName bool
// EnumsAsInts specifies whether to render enum values as integers,
// as opposed to string values.
EnumsAsInts bool
// EmitDefaults specifies whether to render fields with zero values.
EmitDefaults bool
// Indent controls whether the output is compact or not.
// If empty, the output is compact JSON. Otherwise, every JSON object
// entry and JSON array value will be on its own line.
// Each line will be preceded by repeated copies of Indent, where the
// number of copies is the current indentation depth.
Indent string
// AnyResolver is used to resolve the google.protobuf.Any well-known type.
// If unset, the global registry is used by default.
AnyResolver AnyResolver
}
func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error
func (jm *Marshaler) MarshalToString(m proto.Message) (string, error)
type Unmarshaler struct {
// AllowUnknownFields specifies whether to allow messages to contain
// unknown JSON fields, as opposed to failing to unmarshal.
AllowUnknownFields bool
// AnyResolver is used to resolve the google.protobuf.Any well-known type.
// If unset, the global registry is used by default.
AnyResolver AnyResolver
}
func (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error
func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error