protojson

package
v0.12.2 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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUnmarshalProtoJSONFailed = "failed to unmarshal proto JSON: %v"
	ErrReadBodyFailed           = "failed to read body: %v"
)

Variables

View Source
var (
	ErrCodeReadBodyFailed           string
	ErrCodeInvalidProtoMessage      string
	ErrCodeUnmarshalProtoJSONFailed string
)
View Source
var (
	ErrInvalidProtoMessage = errors.New("invalid proto message")
)

Functions

This section is empty.

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) DecodeReader added in v0.12.2

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

func (Decoder) DecodeRequest added in v0.12.2

func (d Decoder) DecodeRequest(
	request *http.Request,
	dest interface{},
) error

DecodeRequest decodes a JSON body from an HTTP request into a destination

Parameters:

  • request: The HTTP request 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