2021-08-30 20:04:15 +02:00
|
|
|
package encoder
|
|
|
|
|
2022-11-02 17:49:03 +01:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
)
|
2021-08-30 20:04:15 +02:00
|
|
|
|
|
|
|
type OptionFlag uint8
|
|
|
|
|
|
|
|
const (
|
|
|
|
HTMLEscapeOption OptionFlag = 1 << iota
|
|
|
|
IndentOption
|
|
|
|
UnorderedMapOption
|
|
|
|
DebugOption
|
|
|
|
ColorizeOption
|
|
|
|
ContextOption
|
2022-11-02 17:49:03 +01:00
|
|
|
NormalizeUTF8Option
|
|
|
|
FieldQueryOption
|
2021-08-30 20:04:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type Option struct {
|
|
|
|
Flag OptionFlag
|
|
|
|
ColorScheme *ColorScheme
|
|
|
|
Context context.Context
|
2022-11-02 17:49:03 +01:00
|
|
|
DebugOut io.Writer
|
2021-08-30 20:04:15 +02: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
|
|
|
|
)
|