Documentation ¶
Index ¶
- func GoGoDisallowUnknownFields()
- func TTNEventStream() runtime.Marshaler
- type GoGoDecoderWrapper
- type GoGoJSONPb
- func (*GoGoJSONPb) ContentType() string
- func (j *GoGoJSONPb) Delimiter() []byte
- func (j *GoGoJSONPb) Marshal(v interface{}) ([]byte, error)
- func (j *GoGoJSONPb) NewDecoder(r io.Reader) Decoder
- func (j *GoGoJSONPb) NewEncoder(w io.Writer) Encoder
- func (j *GoGoJSONPb) Unmarshal(data []byte, v interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoGoDisallowUnknownFields ¶
func GoGoDisallowUnknownFields()
GoGoDisallowUnknownFields enables option in decoder (unmarshaller) to return an error when it finds an unknown field. This function must be called before using the JSON marshaller.
func TTNEventStream ¶
TTNEventStream returns a TTN JsonPb marshaler with double newlines for text/event-stream compatibility.
Types ¶
type GoGoDecoderWrapper ¶
GoGoDecoderWrapper is a wrapper around a *json.Decoder that adds support for protos to the Decode method.
func (GoGoDecoderWrapper) Decode ¶
func (d GoGoDecoderWrapper) Decode(v interface{}) error
Decode wraps the embedded decoder's Decode method to support protos using a jsonpb.Unmarshaler.
type GoGoJSONPb ¶
GoGoJSONPb is a Marshaler which marshals/unmarshals into/from JSON with the "github.com/gogo/protobuf/jsonpb". It supports fully functionality of protobuf unlike JSONBuiltin.
The NewDecoder method returns a GoGoDecoderWrapper, so the underlying *json.Decoder methods can be used.
func (*GoGoJSONPb) ContentType ¶
func (*GoGoJSONPb) ContentType() string
ContentType always returns "application/json".
func (*GoGoJSONPb) Delimiter ¶
func (j *GoGoJSONPb) Delimiter() []byte
Delimiter for newline encoded JSON streams.
func (*GoGoJSONPb) Marshal ¶
func (j *GoGoJSONPb) Marshal(v interface{}) ([]byte, error)
Marshal marshals "v" into JSON.
func (*GoGoJSONPb) NewDecoder ¶
func (j *GoGoJSONPb) NewDecoder(r io.Reader) Decoder
NewDecoder returns a Decoder which reads JSON stream from "r".
func (*GoGoJSONPb) NewEncoder ¶
func (j *GoGoJSONPb) NewEncoder(w io.Writer) Encoder
NewEncoder returns an Encoder which writes JSON stream into "w".
func (*GoGoJSONPb) Unmarshal ¶
func (j *GoGoJSONPb) Unmarshal(data []byte, v interface{}) error
Unmarshal unmarshals JSON "data" into "v"