jsoner

package
v0.0.0-...-69bdcc1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsonSafeMaxInteger = (1 << 53) - 1
	JsonSafeMinInteger = -JsonSafeMaxInteger
)

Variables

View Source
var LogJsoner = NewAPI().
	MaxStringFieldLen(255).
	MaxSliceFieldLen(64).
	EncodeIntegerSafely().
	DecodeGeneralDate()

Functions

func Marshal

func Marshal(val any) []byte

func MarshalLogString

func MarshalLogString(val any) string

func MarshalString

func MarshalString(val any) string

func Unmarshal

func Unmarshal(bts []byte, val any)

func UnmarshalLogString

func UnmarshalLogString(input string, val any)

func UnmarshalString

func UnmarshalString(input string, val any)

Types

type API

type API interface {
	jsoniter.API
	UseAPI(api jsoniter.API) API
	MaxSliceFieldLen(maxLen int) API
	MaxStringFieldLen(maxLen int) API
	EncodeIntegerSafely() API
	DecodeGeneralDate() API
}

func NewAPI

func NewAPI() API

type GeneralDateExtension

type GeneralDateExtension struct {
	jsoniter.DummyExtension
}

func (*GeneralDateExtension) CreateDecoder

func (extension *GeneralDateExtension) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder

func (*GeneralDateExtension) Decode

func (extension *GeneralDateExtension) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator)

type SafeInt64Extension

type SafeInt64Extension struct {
	jsoniter.DummyExtension
}

func (*SafeInt64Extension) CreateDecoder

func (extension *SafeInt64Extension) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder

func (*SafeInt64Extension) CreateEncoder

func (extension *SafeInt64Extension) CreateEncoder(typ reflect2.Type) jsoniter.ValEncoder

func (*SafeInt64Extension) Decode

func (extension *SafeInt64Extension) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator)

func (*SafeInt64Extension) Encode

func (extension *SafeInt64Extension) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream)

func (*SafeInt64Extension) IsEmpty

func (extension *SafeInt64Extension) IsEmpty(ptr unsafe.Pointer) bool

type SafeUint64Extension

type SafeUint64Extension struct {
	jsoniter.DummyExtension
}

func (*SafeUint64Extension) CreateDecoder

func (extension *SafeUint64Extension) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder

func (*SafeUint64Extension) CreateEncoder

func (extension *SafeUint64Extension) CreateEncoder(typ reflect2.Type) jsoniter.ValEncoder

func (*SafeUint64Extension) Decode

func (extension *SafeUint64Extension) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator)

func (*SafeUint64Extension) Encode

func (extension *SafeUint64Extension) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream)

func (*SafeUint64Extension) IsEmpty

func (extension *SafeUint64Extension) IsEmpty(ptr unsafe.Pointer) bool

type SliceMaxLenExtension

type SliceMaxLenExtension struct {
	jsoniter.DummyExtension

	MaxLen int
	// contains filtered or unexported fields
}

func (*SliceMaxLenExtension) DecorateEncoder

func (extension *SliceMaxLenExtension) DecorateEncoder(typ reflect2.Type,
	encoder jsoniter.ValEncoder) jsoniter.ValEncoder

func (*SliceMaxLenExtension) Encode

func (extension *SliceMaxLenExtension) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream)

func (*SliceMaxLenExtension) IsEmpty

func (extension *SliceMaxLenExtension) IsEmpty(ptr unsafe.Pointer) bool

type StringMaxLenExtension

type StringMaxLenExtension struct {
	jsoniter.DummyExtension

	MaxLen int
	// contains filtered or unexported fields
}

func (*StringMaxLenExtension) DecorateEncoder

func (extension *StringMaxLenExtension) DecorateEncoder(typ reflect2.Type,
	encoder jsoniter.ValEncoder) jsoniter.ValEncoder

func (*StringMaxLenExtension) Encode

func (extension *StringMaxLenExtension) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream)

func (*StringMaxLenExtension) IsEmpty

func (extension *StringMaxLenExtension) IsEmpty(ptr unsafe.Pointer) bool

Jump to

Keyboard shortcuts

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