jsonpb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Overview

Package jsonpb implements a JSON <> Protocol Buffer marshaler that supports more protocol buffer options thatn the default stdlib JSON marshaler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONPb

type JSONPb struct{}

JSONPb wraps Google's implementation of a JSON <> Protocol buffer marshaller that has more extented support for protocol buffer fields.

func (*JSONPb) ContentTypes

func (j *JSONPb) ContentTypes() []string

ContentTypes returns the content types the marshaller can handle.

func (*JSONPb) Decode

func (j *JSONPb) Decode(b []byte, v any) error

Decode decodes "data" into "v". "v" must be a pointer value.

func (*JSONPb) Decodes

func (j *JSONPb) Decodes(v any) bool

Decodes returns if this is able to decode the given type.

func (*JSONPb) Encode

func (j *JSONPb) Encode(v any) ([]byte, error)

Encode encodes "v" into byte sequence.

func (*JSONPb) Encodes

func (j *JSONPb) Encodes(v any) bool

Encodes returns if this is able to encode the given type.

func (*JSONPb) Exts

func (j *JSONPb) Exts() []string

Exts is a list of file extensions this marshaler supports.

func (*JSONPb) NewDecoder

func (j *JSONPb) NewDecoder(r io.Reader) codecs.Decoder

NewDecoder returns a new JSON/ProtocolBuffer decoder.

func (*JSONPb) NewEncoder

func (j *JSONPb) NewEncoder(w io.Writer) codecs.Encoder

NewEncoder returns a new JSON/ProtocolBuffer encoder.

func (*JSONPb) String

func (j *JSONPb) String() string

String returns the plugin implementation of the marshaler.

Jump to

Keyboard shortcuts

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