formatter

package
v0.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 3 Imported by: 0

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 Deserializer

type Deserializer interface {
	// Deserialize deserializes data on v
	Deserialize(data []byte, v interface{}) error
}

Deserializer describes ability to deserialize []byte in given format into v

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL