2022-09-28 18:30:40 +01:00
|
|
|
package encoder
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
|
|
|
type OptionFlag uint8
|
|
|
|
|
|
|
|
const (
|
|
|
|
HTMLEscapeOption OptionFlag = 1 << iota
|
|
|
|
IndentOption
|
|
|
|
UnorderedMapOption
|
|
|
|
DebugOption
|
|
|
|
ColorizeOption
|
|
|
|
ContextOption
|
|
|
|
NormalizeUTF8Option
|
|
|
|
FieldQueryOption
|
|
|
|
)
|
|
|
|
|
|
|
|
type Option struct {
|
|
|
|
Flag OptionFlag
|
|
|
|
ColorScheme *ColorScheme
|
|
|
|
Context context.Context
|
|
|
|
DebugOut io.Writer
|
2023-06-01 22:20:16 +01:00
|
|
|
DebugDOTOut io.WriteCloser
|
2022-09-28 18:30:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type EncodeFormat struct {
|
|
|
|
Header string
|
|
|
|
Footer string
|
|
|
|
}
|
|
|
|
|
|
|
|
type EncodeFormatScheme struct {
|
|
|
|
Int EncodeFormat
|
|
|
|
Uint EncodeFormat
|
|
|
|
Float EncodeFormat
|
|
|
|
Bool EncodeFormat
|
|
|
|
String EncodeFormat
|
|
|
|
Binary EncodeFormat
|
|
|
|
ObjectKey EncodeFormat
|
|
|
|
Null EncodeFormat
|
|
|
|
}
|
|
|
|
|
|
|
|
type (
|
|
|
|
ColorScheme = EncodeFormatScheme
|
|
|
|
ColorFormat = EncodeFormat
|
|
|
|
)
|