Documentation ¶
Index ¶
- type JSONDecoder
- type JSONDecoderOption
- type JSONEncoder
- type JSONEncoderOption
- type KeyValue
- type Map
- func (m *Map) Delete(key string) *Map
- func (m *Map) Get(key string) (any, bool)
- func (m *Map) KeyValues() []KeyValue
- func (m *Map) Keys() []string
- func (m *Map) MarshalJSON() ([]byte, error)
- func (m *Map) MarshalYAML() (any, error)
- func (m *Map) Set(key string, value any) *Map
- func (m *Map) UnorderedData() map[string]any
- type TOMLDecoder
- type TOMLDecoderOption
- type TOMLEncoder
- type TOMLEncoderOption
- type YAMLDecoder
- type YAMLDecoderOption
- type YAMLEncoder
- type YAMLEncoderOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONDecoder ¶
type JSONDecoder struct {
// contains filtered or unexported fields
}
JSONDecoder wraps a standard json encoder to implement custom ordering logic.
func NewJSONDecoder ¶
func NewJSONDecoder(r io.Reader, options ...JSONDecoderOption) *JSONDecoder
NewJSONDecoder returns a new dencoding JSONDecoder.
func (*JSONDecoder) Decode ¶
func (decoder *JSONDecoder) Decode(v any) error
Decode decodes the next item found in the decoder and writes it to v.
type JSONDecoderOption ¶
type JSONDecoderOption interface {
ApplyDecoder(decoder *JSONDecoder)
}
JSONDecoderOption is identifies an option that can be applied to a JSON decoder.
type JSONEncoder ¶
type JSONEncoder struct {
// contains filtered or unexported fields
}
JSONEncoder wraps a standard json encoder to implement custom ordering logic.
func NewJSONEncoder ¶
func NewJSONEncoder(w io.Writer, options ...JSONEncoderOption) *JSONEncoder
NewJSONEncoder returns a new dencoding JSONEncoder.
func (*JSONEncoder) Encode ¶
func (encoder *JSONEncoder) Encode(v any) error
Encode encodes the given value and writes the encodes bytes to the stream.
type JSONEncoderOption ¶
type JSONEncoderOption interface {
ApplyEncoder(encoder *JSONEncoder)
}
JSONEncoderOption is identifies an option that can be applied to a JSON encoder.
func JSONEncodeIndent ¶
func JSONEncodeIndent(prefix string, indent string) JSONEncoderOption
JSONEncodeIndent sets the indentation when encoding JSON.
func JSONEscapeHTML ¶
func JSONEscapeHTML(escape bool) JSONEncoderOption
JSONEscapeHTML enables or disables html escaping when encoding JSON.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a map implementation that maintains ordering of keys.
func FromMap ¶
FromMap creates a *Map from the input map. Note that while the contents will be ordered, the ordering is not guaranteed since the input map is unordered.
func (*Map) KeyValues ¶
KeyValues returns the KeyValue pairs within the map, in the order that they were added.
func (*Map) MarshalJSON ¶
MarshalJSON JSON encodes the map and returns the bytes. This maintains ordering.
func (*Map) MarshalYAML ¶
MarshalYAML YAML encodes the map and returns the bytes. This maintains ordering.
func (*Map) UnorderedData ¶
UnorderedData returns all the data from the map.
type TOMLDecoder ¶
type TOMLDecoder struct {
// contains filtered or unexported fields
}
TOMLDecoder wraps a standard toml encoder to implement custom ordering logic.
func NewTOMLDecoder ¶
func NewTOMLDecoder(r io.Reader, options ...TOMLDecoderOption) *TOMLDecoder
NewTOMLDecoder returns a new dencoding TOMLDecoder.
func (*TOMLDecoder) Decode ¶
func (decoder *TOMLDecoder) Decode(v any) error
Decode decodes the next item found in the decoder and writes it to v.
type TOMLDecoderOption ¶
type TOMLDecoderOption interface {
ApplyDecoder(decoder *TOMLDecoder)
}
TOMLDecoderOption is identifies an option that can be applied to a TOML decoder.
type TOMLEncoder ¶
type TOMLEncoder struct {
// contains filtered or unexported fields
}
TOMLEncoder wraps a standard toml encoder to implement custom ordering logic.
func NewTOMLEncoder ¶
func NewTOMLEncoder(w io.Writer, options ...TOMLEncoderOption) *TOMLEncoder
NewTOMLEncoder returns a new dencoding TOMLEncoder.
func (*TOMLEncoder) Encode ¶
func (encoder *TOMLEncoder) Encode(v any) error
Encode encodes the given value and writes the encodes bytes to the stream.
type TOMLEncoderOption ¶
type TOMLEncoderOption interface {
ApplyEncoder(encoder *TOMLEncoder)
}
TOMLEncoderOption is identifies an option that can be applied to a TOML encoder.
func TOMLIndentSymbol ¶
func TOMLIndentSymbol(symbol string) TOMLEncoderOption
TOMLIndentSymbol sets the indentation when encoding TOML.
type YAMLDecoder ¶
type YAMLDecoder struct {
// contains filtered or unexported fields
}
YAMLDecoder wraps a standard yaml encoder to implement custom ordering logic.
func NewYAMLDecoder ¶
func NewYAMLDecoder(r io.Reader, options ...YAMLDecoderOption) *YAMLDecoder
NewYAMLDecoder returns a new dencoding YAMLDecoder.
func (*YAMLDecoder) Decode ¶
func (decoder *YAMLDecoder) Decode(v any) error
Decode decodes the next item found in the decoder and writes it to v.
type YAMLDecoderOption ¶
type YAMLDecoderOption interface {
ApplyDecoder(decoder *YAMLDecoder)
}
YAMLDecoderOption is identifies an option that can be applied to a YAML decoder.
type YAMLEncoder ¶
type YAMLEncoder struct {
// contains filtered or unexported fields
}
YAMLEncoder wraps a standard yaml encoder to implement custom ordering logic.
func NewYAMLEncoder ¶
func NewYAMLEncoder(w io.Writer, options ...YAMLEncoderOption) *YAMLEncoder
NewYAMLEncoder returns a new dencoding YAMLEncoder.
func (*YAMLEncoder) Encode ¶
func (encoder *YAMLEncoder) Encode(v any) error
Encode encodes the given value and writes the encodes bytes to the stream.
type YAMLEncoderOption ¶
type YAMLEncoderOption interface {
ApplyEncoder(encoder *YAMLEncoder)
}
YAMLEncoderOption is identifies an option that can be applied to a YAML encoder.
func YAMLEncodeIndent ¶
func YAMLEncodeIndent(spaces int) YAMLEncoderOption
YAMLEncodeIndent sets the indentation when encoding YAML.