json

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeMarshalResponseBodyFailed *string
)

Functions

This section is empty.

Types

type DefaultEncoder

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

DefaultEncoder struct

func NewDefaultEncoder

func NewDefaultEncoder(mode *mode.Flag) *DefaultEncoder

NewDefaultEncoder creates a new default JSON encoder

Parameters:

  • mode: The flag mode

Returns:

  • *DefaultEncoder: The default encoder

func (DefaultEncoder) Encode

func (d DefaultEncoder) Encode(
	w http.ResponseWriter,
	response gonethttpresponse.Response,
) (err error)

Encode encodes the body into JSON and writes it to the response

Parameters:

  • w: The HTTP response writer
  • response: The response to encode

Returns:

  • error: The error if any

type DefaultStreamEncoder

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

DefaultStreamEncoder is the JSON encoder struct

func NewDefaultStreamEncoder

func NewDefaultStreamEncoder(mode *goflagsmode.Flag) *DefaultStreamEncoder

NewDefaultStreamEncoder creates a new JSON encoder

Parameters:

  • mode: The flag mode

Returns:

  • *DefaultStreamEncoder: The default encoder

func (DefaultStreamEncoder) Encode

Encode encodes the body into JSON and writes it to the response

Parameters:

  • w: The HTTP response writer
  • response: The response to encode

Returns:

  • error: The error if any

Jump to

Keyboard shortcuts

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