codec

package
v1.68.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package codec provides encoding/decoding utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSON

type JSON struct {
	MaxSnippetSize int
}

JSON is a factory for JSON encoders and decoders.

func (*JSON) NewDecoder

func (j *JSON) NewDecoder(r io.Reader) *jsonDecoder

NewDecoder returns a new encoding/json style decoder augmenting it with snippets of the payload in case of errors.

func (*JSON) NewEncoder

func (j *JSON) NewEncoder(w io.Writer) *jsonEncoder

NewEncoder does not do anything different from the default encoder. Unfortunately, the default encoder does not do any writes at all until the full encoding has succeeded, so we cannot buffer the write and add it to the error like is done for the json.Decoder.

Jump to

Keyboard shortcuts

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