Documentation ¶
Overview ¶
Package formatter holds utilities for working with different data formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwareFormatter ¶
type AwareFormatter struct { JSONFormatter JSONFormatter YAMLFormatter YAMLFormatter }
AwareFormatter is entity that has ability to deserialize data in JSON or YAML format
func NewAwareFormatter ¶
func NewAwareFormatter(JSONFormatter JSONFormatter, YAMLFormatter YAMLFormatter) AwareFormatter
func (AwareFormatter) Deserialize ¶
func (a AwareFormatter) Deserialize(data []byte, v any) error
Deserialize data in format of JSON or YAML on v
type Formatter ¶ added in v0.12.0
type Formatter interface { // Deserialize deserializes data on v Deserialize(data []byte, v any) error // Serialize serializes v Serialize(v any) ([]byte, error) }
Formatter describes ability to serialize and deserialize data
type JSONFormatter ¶
type JSONFormatter struct{}
JSONFormatter is entity that has ability to work with JSON format
func NewJSONFormatter ¶
func NewJSONFormatter() JSONFormatter
func (JSONFormatter) Deserialize ¶
func (J JSONFormatter) Deserialize(data []byte, v any) error
Deserialize data in format of JSON on v
type XMLFormatter ¶ added in v0.13.0
type XMLFormatter struct{}
XMLFormatter is entity that has ability to work with XML format
func NewXMLFormatter ¶ added in v0.13.0
func NewXMLFormatter() XMLFormatter
func (XMLFormatter) Deserialize ¶ added in v0.13.0
func (X XMLFormatter) Deserialize(data []byte, v any) error
Deserialize data in format of XML on v.
type YAMLFormatter ¶
type YAMLFormatter struct{}
YAMLFormatter is entity that has ability to work with YAML format
func NewYAMLFormatter ¶
func NewYAMLFormatter() YAMLFormatter
func (YAMLFormatter) Deserialize ¶
func (Y YAMLFormatter) Deserialize(data []byte, v any) error
Deserialize data in format of YAML on v
Click to show internal directories.
Click to hide internal directories.