Documentation ¶
Index ¶
- func Marshal(msg Message, opts ...EncoderOption) ([]byte, error)
- func MarshalToString(msg Message, opts ...EncoderOption) (string, error)
- func Unmarshal(b []byte, msg Message, opts ...DecoderOption) error
- func UnmarshalString(str string, msg Message, opts ...DecoderOption) error
- type Decoder
- type DecoderOption
- type Encoder
- type EncoderOption
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalToString ¶
func MarshalToString(msg Message, opts ...EncoderOption) (string, error)
func Unmarshal ¶
func Unmarshal(b []byte, msg Message, opts ...DecoderOption) error
Unmarshal unmarshals a byte array into a proto message.
func UnmarshalString ¶
func UnmarshalString(str string, msg Message, opts ...DecoderOption) error
UnmarshalString unmarshals a string into a proto message.
Types ¶
type Decoder ¶
type Decoder struct { jsonpb.Unmarshaler // contains filtered or unexported fields }
func NewDecoder ¶
func NewDecoder(r io.Reader, opts ...DecoderOption) *Decoder
type DecoderOption ¶
type DecoderOption func(*decoderOptions)
func AllowUnknownFields ¶
func AllowUnknownFields(b bool) DecoderOption
type Encoder ¶
func NewEncoder ¶
func NewEncoder(w io.Writer, opts ...EncoderOption) *Encoder
type EncoderOption ¶
type EncoderOption func(*encoderOptions)
func WithDefaults ¶
func WithDefaults(enable bool) EncoderOption
WithDefaults ensures all fields are emitted, even when they have the default value (the "zero" value).
func WithIndent ¶
func WithIndent(indent string) EncoderOption
func WithIndentDepth ¶
func WithIndentDepth(indentDepth int) EncoderOption
Click to show internal directories.
Click to hide internal directories.