json

package
v1.0.0-dev.107 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func Register

func Register(ctx context.Context, server *e.Server) error

Register registers a new goccy/go-json plugin for echo.

Types

type DefaultJSONSerializer

type DefaultJSONSerializer struct{}

DefaultJSONSerializer implements JSON encoding using encoding/json.

func (DefaultJSONSerializer) Deserialize

func (d DefaultJSONSerializer) Deserialize(c echo.Context, i interface{}) error

Deserialize reads a JSON from a request body and converts it into an interface.

func (DefaultJSONSerializer) Serialize

func (d DefaultJSONSerializer) Serialize(c echo.Context, i interface{}, indent string) error

Serialize converts an interface into a json and writes it to the response. You can optionally use the indent parameter to produce pretty JSONs.

type Json

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

Json represents a goccy/go-json plugin for echo.

func NewJson

func NewJson() *Json

NewJson returns a new goccy/go-json plugin with default options.

func NewJsonWithConfigPath

func NewJsonWithConfigPath(path string) (*Json, error)

NewJsonWithConfigPath returns a new goccy/go-json plugin with options from config path.

func NewJsonWithOptions

func NewJsonWithOptions(options *Options) *Json

NewJsonWithOptions returns a new goccy/go-json plugin with options.

func (*Json) Register

func (i *Json) Register(ctx context.Context, server *e.Server) error

Register registers this goccy/go-json plugin for echo.

type Options

type Options struct {
	Enabled bool
}

Options represents goccy/go-json plugin for fiber options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals a given key path into options and returns it.

Jump to

Keyboard shortcuts

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