Documentation ¶
Index ¶
- Constants
- func BytesToString(b []byte) string
- func RegisterDecoder[T any](fn DecoderFn)
- type Config
- func (c *Config) NewDecoder(data []byte) *Decoder
- func (c *Config) Unmarshal(data []byte, v any) error
- func (c *Config) UnmarshalCtx(data []byte, v any, ctx *ctx.Ctx) error
- func (c *Config) UnmarshalScoped(data []byte, v any, operation scopes.Decoding) error
- func (c *Config) UnmarshalScopedCtx(data []byte, v any, operation scopes.Decoding, ctx *ctx.Ctx) error
- func (c *Config) UnmarshalScopedWithChanges(data []byte, v any, operation scopes.Decoding) ([]string, error)
- func (c *Config) UnmarshalScopedWithChangesCtx(data []byte, v any, operation scopes.Decoding, ctx *ctx.Ctx) ([]string, error)
- func (c *Config) UnmarshalWithChanges(data []byte, v any) ([]string, error)
- func (c *Config) UnmarshalWithChangesCtx(data []byte, v any, ctx *ctx.Ctx) ([]string, error)
- type Decoder
- func (d *Decoder) Context() scopes.Context
- func (d *Decoder) DecodeString() (string, error)
- func (d *Decoder) Decoder(data []byte) *Decoder
- func (d *Decoder) Error(msg string) error
- func (d *Decoder) ErrorF(format string, args ...any) error
- func (d *Decoder) Operation() scopes.Decoding
- func (d *Decoder) Release()
- func (d *Decoder) ScanArray() (int, error)
- func (d *Decoder) ScanNull() error
- func (d *Decoder) ScanObject() (int, error)
- func (d *Decoder) Skip() error
- func (d *Decoder) SkipArray() error
- func (d *Decoder) SkipExponent() error
- func (d *Decoder) SkipFalse() error
- func (d *Decoder) SkipFloat() error
- func (d *Decoder) SkipMinus(isFloat bool) error
- func (d *Decoder) SkipNumber(withDecimal, withExponent bool) error
- func (d *Decoder) SkipObject() error
- func (d *Decoder) SkipString() error
- func (d *Decoder) SkipTrue() error
- func (d *Decoder) SkipWhitespace()
- func (d *Decoder) SkipZero(isFloat bool) error
- func (d *Decoder) Unmarshal(data []byte, v any) error
- func (d *Decoder) UnmarshalScoped(data []byte, v any, operation scopes.Decoding) error
- func (d *Decoder) UnmarshalScopedWithChanges(data []byte, v any, operation scopes.Decoding) ([]string, error)
- func (d *Decoder) UnmarshalWithChanges(data []byte, v any) ([]string, error)
- type DecoderFn
- type Error
- type Unmarshaler
Constants ¶
const MAX_DEPTH = 1000
const TERMINATION_CHAR = '\000'
In order to decode, you have to traverse the input buffer character by position. At that time, if you check whether the buffer has reached the end, it will be very slow. Therefore, by adding the NUL (\000) character to the end of the read buffer as shown below, it is possible to check the termination character at the same time as other characters.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func RegisterDecoder ¶
Types ¶
type Config ¶
Config is a configuration for the decoder. It can be used to define the scope of the decoding ones and reuse it multiple times.
func (*Config) NewDecoder ¶
NewDecoder creates a new decoder with the given data.
func (*Config) UnmarshalCtx ¶
UnmarshalCtx sets the *ctx.Ctx and decodes the data into the given value.
func (*Config) UnmarshalScoped ¶
UnmarshalScoped decodes the data into the given value with the given scope.
func (*Config) UnmarshalScopedCtx ¶
func (c *Config) UnmarshalScopedCtx(data []byte, v any, operation scopes.Decoding, ctx *ctx.Ctx) error
UnmarshalScopedCtx sets the *ctx.Ctx and decodes the data into the given value with the given scope.
func (*Config) UnmarshalScopedWithChanges ¶
func (c *Config) UnmarshalScopedWithChanges(data []byte, v any, operation scopes.Decoding) ([]string, error)
UnmarshalScopedWithChanges decodes the data into the given value with the given scope and returns the changes. The changes are the paths of the fields that have been changed.
func (*Config) UnmarshalScopedWithChangesCtx ¶
func (c *Config) UnmarshalScopedWithChangesCtx(data []byte, v any, operation scopes.Decoding, ctx *ctx.Ctx) ([]string, error)
UnmarshalScopedWithChangesCtx sets the *ctx.Ctx and decodes the data into the given value with the given scope and returns the changes. The changes are the paths of the fields that have been changed.
func (*Config) UnmarshalWithChanges ¶
UnmarshalWithChanges decodes the data into the given value and returns the changes. The changes are the paths of the fields that have been changed.
func (*Config) UnmarshalWithChangesCtx ¶
UnmarshalWithChangesCtx sets the *ctx.Ctx and decodes the data into the given value and returns the changes. The changes are the paths of the fields that have been changed.
type Decoder ¶
type Decoder struct { *ctx.Ctx Buf []byte Changes []string ChangesPrefix string // contains filtered or unexported fields }
func (*Decoder) DecodeString ¶
func (*Decoder) ScanObject ¶
func (*Decoder) SkipExponent ¶
func (*Decoder) SkipNumber ¶
func (*Decoder) SkipObject ¶
func (*Decoder) SkipString ¶
func (*Decoder) SkipWhitespace ¶
func (d *Decoder) SkipWhitespace()