jsonpb

package
v0.0.0-...-6a0c198 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 8 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoGoJSONPb

type GoGoJSONPb jsonpb.Marshaler

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.

func (*GoGoJSONPb) ContentType

func (*GoGoJSONPb) ContentType() string

ContentType always returns "application/json".

func (*GoGoJSONPb) Marshal

func (j *GoGoJSONPb) Marshal(v interface{}) ([]byte, error)

Marshal marshals "v" into JSON Currently it can marshal only proto.Message. TODO(yugui) Support fields of primitive types in a message.

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" Currently it can marshal only proto.Message. TODO(yugui) Support fields of primitive types in a message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL