option.go 751 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package encoder
  2. import (
  3. "context"
  4. "io"
  5. )
  6. type OptionFlag uint8
  7. const (
  8. HTMLEscapeOption OptionFlag = 1 << iota
  9. IndentOption
  10. UnorderedMapOption
  11. DebugOption
  12. ColorizeOption
  13. ContextOption
  14. NormalizeUTF8Option
  15. FieldQueryOption
  16. )
  17. type Option struct {
  18. Flag OptionFlag
  19. ColorScheme *ColorScheme
  20. Context context.Context
  21. DebugOut io.Writer
  22. DebugDOTOut io.WriteCloser
  23. }
  24. type EncodeFormat struct {
  25. Header string
  26. Footer string
  27. }
  28. type EncodeFormatScheme struct {
  29. Int EncodeFormat
  30. Uint EncodeFormat
  31. Float EncodeFormat
  32. Bool EncodeFormat
  33. String EncodeFormat
  34. Binary EncodeFormat
  35. ObjectKey EncodeFormat
  36. Null EncodeFormat
  37. }
  38. type (
  39. ColorScheme = EncodeFormatScheme
  40. ColorFormat = EncodeFormat
  41. )