2020-09-16 12:23:43 +03:00
|
|
|
package json
|
|
|
|
|
2021-05-31 16:25:33 +03:00
|
|
|
import (
|
|
|
|
"github.com/goccy/go-json/internal/encoder"
|
|
|
|
)
|
2020-09-16 12:23:43 +03:00
|
|
|
|
2021-05-31 16:25:33 +03:00
|
|
|
type EncodeOption = encoder.Option
|
|
|
|
|
|
|
|
type EncodeOptionFunc func(*EncodeOption)
|
|
|
|
|
|
|
|
func UnorderedMap() EncodeOptionFunc {
|
|
|
|
return func(opt *EncodeOption) {
|
|
|
|
opt.UnorderedMap = true
|
2020-09-16 12:23:43 +03:00
|
|
|
}
|
|
|
|
}
|
2021-03-27 06:18:19 +03:00
|
|
|
|
2021-05-31 16:25:33 +03:00
|
|
|
func Debug() EncodeOptionFunc {
|
|
|
|
return func(opt *EncodeOption) {
|
|
|
|
opt.Debug = true
|
2021-03-27 06:18:19 +03:00
|
|
|
}
|
|
|
|
}
|
2021-05-31 18:46:42 +03:00
|
|
|
|
|
|
|
func Colorize(scheme *ColorScheme) EncodeOptionFunc {
|
|
|
|
return func(opt *EncodeOption) {
|
|
|
|
opt.Colorize = true
|
|
|
|
opt.ColorScheme = scheme
|
|
|
|
}
|
|
|
|
}
|