protojson

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalByReflection

func UnmarshalByReflection(
	reader io.Reader,
	dest interface{},
	unmarshalOptions *protojson.UnmarshalOptions,
) error

UnmarshalByReflection decodes JSON from io.Reader into a destination, handling nested proto.Message fields.

Parameters:

  • r: The io.Reader to read JSON data from
  • dest: The destination to decode the JSON data into
  • unmarshalOptions: Options for unmarshalling proto messages (optional, can be nil)

Returns:

  • error: The error if any

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder() *Decoder

NewDecoder creates a new Decoder instance

Returns:

  • *Decoder: The decoder instance

func (Decoder) Decode

func (d Decoder) Decode(
	body interface{},
	dest interface{},
) error

Decode decodes the JSON body from an any value and stores it in the destination

Parameters:

  • body: The body to decode
  • dest: The destination to store the decoded body

Returns:

  • error: The error if any

func (Decoder) DecodeReader

func (d Decoder) DecodeReader(
	reader io.Reader,
	dest interface{},
) error

DecodeReader decodes a JSON body from a reader into a destination

Parameters:

  • reader: The io.Reader to read the body from
  • dest: The destination to decode the body into

Returns:

  • error: The error if any

Jump to

Keyboard shortcuts

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