json

package
v0.6.32 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package json json encoder/decoder

Index

Constants

This section is empty.

Variables

View Source
var WRAPPER_END = []byte(`"items": [`)

Functions

This section is empty.

Types

type Encoder

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

func NewEncoder

func NewEncoder(req any) (*Encoder, error)

func (*Encoder) GetFormatInstructions

func (e *Encoder) GetFormatInstructions() string

func (*Encoder) Marshal

func (e *Encoder) Marshal(req any) ([]byte, error)

func (*Encoder) Schema

func (e *Encoder) Schema() *schema.Schema

func (*Encoder) Unmarshal

func (e *Encoder) Unmarshal(bs []byte, ret any) error

func (*Encoder) Validate

func (e *Encoder) Validate(req any) error

type StreamEncoder

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

func NewStreamEncoder

func NewStreamEncoder(req any, validate bool) (*StreamEncoder, error)

func (*StreamEncoder) EnableValidate

func (e *StreamEncoder) EnableValidate()

func (*StreamEncoder) GetFormatInstructions

func (e *StreamEncoder) GetFormatInstructions() string

func (*StreamEncoder) Marshal

func (e *StreamEncoder) Marshal(req any) ([]byte, error)

func (*StreamEncoder) Read

func (e *StreamEncoder) Read(ctx context.Context, ch <-chan string) <-chan any

func (*StreamEncoder) Schema

func (e *StreamEncoder) Schema() *schema.Schema

func (*StreamEncoder) Validate

func (e *StreamEncoder) Validate(req any) error

type StreamWrapper

type StreamWrapper[T any] struct {
	Items []T `json:"items"`
}

Jump to

Keyboard shortcuts

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