jsoncodec

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SonicJSON

type SonicJSON struct {
	Config        sonic.Config
	ConfigDefault sonic.API
}

SonicJSON Wrap sonic 默认sonic不支持html逃逸转义和SortKeys,有需要的场景自定义设置

func SonicJsonDefault

func SonicJsonDefault() *SonicJSON

SonicJsonDefault sonic ConfigDefault

func SonicJsonEscape

func SonicJsonEscape() *SonicJSON

SonicJsonEscape just start HTML escape

func SonicJsonFastest

func SonicJsonFastest() *SonicJSON

SonicJsonFastest sonic ConfigFastest

func SonicJsonSortEscape

func SonicJsonSortEscape() *SonicJSON

SonicJsonSortEscape just start Keys Sort & HTML escape

func SonicJsonStd

func SonicJsonStd() *SonicJSON

SonicJsonStd sonic ConfigStd

func (*SonicJSON) Marshal

func (s *SonicJSON) Marshal(v interface{}) ([]byte, error)

Marshal use Sonic Marshal

func (*SonicJSON) MarshalIndent

func (s *SonicJSON) MarshalIndent(v any, prefix, indent string) ([]byte, error)

MarshalIndent use Sonic MarshalIndent

func (*SonicJSON) NewDecoder

func (s *SonicJSON) NewDecoder(reader io.Reader) ginJson.Decoder

NewDecoder use Sonic NewDecoder

func (*SonicJSON) NewEncoder

func (s *SonicJSON) NewEncoder(writer io.Writer) ginJson.Encoder

NewEncoder use Sonic NewEncoder

func (*SonicJSON) SetCfg

func (s *SonicJSON) SetCfg(cfg ...sonic.Config) *SonicJSON

SetCfg set sonic config

func (*SonicJSON) Unmarshal

func (s *SonicJSON) Unmarshal(data []byte, v interface{}) error

Unmarshal use Sonic Unmarshal

type StdJSON

type StdJSON struct{}

StdJSON 使用标准库 encoding/json 的编解码实现

func StdJsonDefault

func StdJsonDefault() *StdJSON

StdJsonDefault 返回标准库 JSON 编解码器实例

func (*StdJSON) Marshal

func (s *StdJSON) Marshal(v interface{}) ([]byte, error)

Marshal 使用标准库 json.Marshal

func (*StdJSON) MarshalIndent

func (s *StdJSON) MarshalIndent(v any, prefix, indent string) ([]byte, error)

MarshalIndent 使用标准库 json.MarshalIndent

func (*StdJSON) NewDecoder

func (s *StdJSON) NewDecoder(reader io.Reader) ginJson.Decoder

NewDecoder 使用标准库 json.NewDecoder

func (*StdJSON) NewEncoder

func (s *StdJSON) NewEncoder(writer io.Writer) ginJson.Encoder

NewEncoder 使用标准库 json.NewEncoder

func (*StdJSON) Unmarshal

func (s *StdJSON) Unmarshal(data []byte, v interface{}) error

Unmarshal 使用标准库 json.Unmarshal

Jump to

Keyboard shortcuts

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