2021-05-31 16:25:33 +03:00
|
|
|
package encoder
|
|
|
|
|
2022-03-24 23:09:22 +03:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
)
|
2021-06-12 11:06:26 +03:00
|
|
|
|
2021-06-01 07:40:15 +03:00
|
|
|
type OptionFlag uint8
|
|
|
|
|
|
|
|
const (
|
|
|
|
HTMLEscapeOption OptionFlag = 1 << iota
|
|
|
|
IndentOption
|
|
|
|
UnorderedMapOption
|
|
|
|
DebugOption
|
|
|
|
ColorizeOption
|
2021-06-12 11:06:26 +03:00
|
|
|
ContextOption
|
2021-12-30 05:54:29 +03:00
|
|
|
NormalizeUTF8Option
|
2022-01-03 06:33:51 +03:00
|
|
|
FieldQueryOption
|
2021-06-01 07:40:15 +03:00
|
|
|
)
|
|
|
|
|
2021-05-31 16:25:33 +03:00
|
|
|
type Option struct {
|
2021-06-01 07:40:15 +03:00
|
|
|
Flag OptionFlag
|
|
|
|
ColorScheme *ColorScheme
|
2021-06-12 11:06:26 +03:00
|
|
|
Context context.Context
|
2022-03-24 23:09:22 +03:00
|
|
|
DebugOut io.Writer
|
2021-05-31 16:25:33 +03:00
|
|
|
}
|
2021-05-31 18:46:42 +03:00
|
|
|
|
|
|
|
type EncodeFormat struct {
|
|
|
|
Header string
|
|
|
|
Footer string
|
|
|
|
}
|
|
|
|
|
|
|
|
type EncodeFormatScheme struct {
|
2021-06-01 09:10:28 +03:00
|
|
|
Int EncodeFormat
|
|
|
|
Uint EncodeFormat
|
|
|
|
Float EncodeFormat
|
|
|
|
Bool EncodeFormat
|
|
|
|
String EncodeFormat
|
|
|
|
Binary EncodeFormat
|
|
|
|
ObjectKey EncodeFormat
|
|
|
|
Null EncodeFormat
|
2021-05-31 18:46:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type (
|
|
|
|
ColorScheme = EncodeFormatScheme
|
|
|
|
ColorFormat = EncodeFormat
|
|
|
|
)
|