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
- type NewDecoder
- type TTNEncoder
- type TTNMarshaler
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"
type NewDecoder ¶ added in v3.15.1
type NewDecoder struct {
// contains filtered or unexported fields
}
func (*NewDecoder) Decode ¶ added in v3.15.1
func (d *NewDecoder) Decode(v interface{}) error
type TTNEncoder ¶ added in v3.15.1
type TTNEncoder struct {
// contains filtered or unexported fields
}
func (*TTNEncoder) Encode ¶ added in v3.15.1
func (e *TTNEncoder) Encode(v interface{}) error
type TTNMarshaler ¶ added in v3.15.1
type TTNMarshaler struct {
*GoGoJSONPb
}
func (*TTNMarshaler) ContentType ¶ added in v3.15.1
func (*TTNMarshaler) ContentType() string
func (*TTNMarshaler) Marshal ¶ added in v3.15.1
func (m *TTNMarshaler) Marshal(v interface{}) ([]byte, error)
func (*TTNMarshaler) NewDecoder ¶ added in v3.15.1
func (m *TTNMarshaler) NewDecoder(r io.Reader) runtime.Decoder
func (*TTNMarshaler) NewEncoder ¶ added in v3.15.1
func (m *TTNMarshaler) NewEncoder(w io.Writer) runtime.Encoder
func (*TTNMarshaler) Unmarshal ¶ added in v3.15.1
func (m *TTNMarshaler) Unmarshal(data []byte, v interface{}) error