Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct { protojson.MarshalOptions protojson.UnmarshalOptions }
Codec is a Marshaler which marshals/unmarshals into/from JSON with the "google.golang.org/protobuf/encoding/protojson" marshaler. It supports the full functionality of protobuf unlike JSONBuiltin.
The NewDecoder method returns a DecoderWrapper, so the underlying *json.Decoder methods can be used.
func (*Codec) ContentType ¶
ContentType always Returns "application/json; charset=utf-8".
func (*Codec) NewDecoder ¶
NewDecoder returns a Decoder which reads JSON stream from "r".
func (*Codec) NewEncoder ¶
NewEncoder returns an Encoder which writes JSON stream into "w".
type DecoderWrapper ¶
type DecoderWrapper struct { *json.Decoder protojson.UnmarshalOptions }
DecoderWrapper is a wrapper around a *json.Decoder that adds support for protos to the Decode method.
func (DecoderWrapper) Decode ¶
func (d DecoderWrapper) Decode(v any) error
Decode wraps the embedded decoder's Decode method to support protos using a jsonpb.Unmarshaler.