Documentation ¶
Index ¶
- Constants
- func AddIndent(b []byte) []byte
- func RegisterEncoder[T any](fn EncoderFn)
- type Config
- func (c *Config) Marshal(v any) ([]byte, error)
- func (c *Config) MarshalCtx(v any, ctx *ctx.Ctx) ([]byte, error)
- func (c *Config) MarshalPartial(v any, fields []string, short bool) ([]byte, error)
- func (c *Config) MarshalPartialCtx(v any, fields []string, short bool, ctx *ctx.Ctx) ([]byte, error)
- func (c *Config) NewEncoder() *Encoder
- func (c *Config) Return(e *Encoder)
- type Encoder
- func (e *Encoder) Context() scopes.Context
- func (e *Encoder) Encode(v any) error
- func (e *Encoder) EncodeFloat(v reflect.Value, bits int) error
- func (e *Encoder) EncodeMap(v reflect.Value, keyEnc, valueEnc EncoderFn) error
- func (e *Encoder) EncodePartial(v any, fields []string, short int) error
- func (e *Encoder) EncodeSlice(v reflect.Value, valueEnc EncoderFn) (err error)
- func (e *Encoder) Error(msg string) error
- func (e *Encoder) ErrorF(format string, args ...interface{}) error
- func (e *Encoder) GetCurrentPath() string
- func (e *Encoder) GetFields() []string
- func (e *Encoder) Marshal(v any) ([]byte, error)
- func (e *Encoder) MarshalPartial(v any, fields []string, short bool) ([]byte, error)
- func (e *Encoder) Reset()
- func (e *Encoder) Write(b []byte)
- func (e *Encoder) WriteByte(b byte)
- func (e *Encoder) WriteString(s string)
- type EncoderFn
- type Marshaler
Constants ¶
View Source
const MAX_DEPTH = 10000
Variables ¶
This section is empty.
Functions ¶
func RegisterEncoder ¶
Types ¶
type Config ¶
func (*Config) MarshalPartial ¶
func (*Config) MarshalPartialCtx ¶
func (*Config) NewEncoder ¶
type Encoder ¶
func (*Encoder) EncodePartial ¶
EncodePartial works like MarshalPartial but it will respect partial settings of the encoder If fields were set by MarshalPartial, it will preserve them. If you set short parameter to 1 it will use short encoding for the fields, 0 will not use short encoding, -1 will preserve the current setting If you pass fields, their names will be prepended with the current path of the encoder
func (*Encoder) EncodeSlice ¶
func (*Encoder) GetCurrentPath ¶
GetCurrentPath will return the path of the current field being encoded if encoder is created by MarshalPartial Otherwise it will return an empty string
func (*Encoder) GetFields ¶
GetFields will return the fields that should be encoded if encoder is created by MarshalPartial Otherwise it will return an empty slice
func (*Encoder) MarshalPartial ¶
func (*Encoder) WriteString ¶
Click to show internal directories.
Click to hide internal directories.