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 interface{}) 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 interface{}) error // Serialize serializes v Serialize(v interface{}) ([]byte, error) }
Formatter describes ability to serialize and deserialize data
type JSONFormatter ¶
type JSONFormatter struct{}
JSONFormatter is entity that has ability to deserialize data in JSON format
func NewJSONFormatter ¶
func NewJSONFormatter() JSONFormatter
func (JSONFormatter) Deserialize ¶
func (J JSONFormatter) Deserialize(data []byte, v interface{}) error
Deserialize data in format of JSON on v
func (JSONFormatter) Serialize ¶ added in v0.12.0
func (J JSONFormatter) Serialize(v interface{}) ([]byte, error)
Serialize serializes v into JSON format.
type YAMLFormatter ¶
type YAMLFormatter struct{}
YAMLFormatter is entity that has ability to deserialize data in YAML format
func NewYAMLFormatter ¶
func NewYAMLFormatter() YAMLFormatter
func (YAMLFormatter) Deserialize ¶
func (Y YAMLFormatter) Deserialize(data []byte, v interface{}) error
Deserialize data in format of YAML on v
func (YAMLFormatter) Serialize ¶ added in v0.12.0
func (y YAMLFormatter) Serialize(v interface{}) ([]byte, error)
Serialize serializes v into YAML format.
Click to show internal directories.
Click to hide internal directories.