Documentation
¶
Overview ¶
Package types holds utilities for working with different formats data types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataType ¶
type DataType string
DataType represents data type.
const ( Array DataType = "array" Bool DataType = "bool" Boolean DataType = "boolean" DateTime DataType = "dateTime" Float DataType = "float" Int DataType = "int" Integer DataType = "integer" Map DataType = "map" Mapping DataType = "mapping" Nil DataType = "nil" Null DataType = "null" Number DataType = "number" Object DataType = "object" Scalar DataType = "scalar" Sequence DataType = "sequence" Slice DataType = "slice" String DataType = "string" )
func (DataType) IsValidGoDataType ¶
IsValidGoDataType checks whether is valid Go-like data type.
func (DataType) IsValidJSONDataType ¶
IsValidJSONDataType checks whether is valid JSON data type.
func (DataType) IsValidXMLDataType ¶
IsValidXMLDataType checks whether is valid XML data type.
func (DataType) IsValidYAMLDataType ¶
IsValidYAMLDataType checks whether is valid YAML data type.
type GoTypeMapper ¶
type GoTypeMapper struct{}
GoTypeMapper is entity that has ability to map underlying data type into corresponding Go-like data type.
func NewGoTypeMapper ¶
func NewGoTypeMapper() GoTypeMapper
func (GoTypeMapper) Map ¶
func (g GoTypeMapper) Map(data any) DataType
Map maps data underlying type into Go-like data type.
type JSONTypeMapper ¶
type JSONTypeMapper struct{}
JSONTypeMapper is entity that has ability to map underlying data type into corresponding JSON data type.
func NewJSONTypeMapper ¶
func NewJSONTypeMapper() JSONTypeMapper
func (JSONTypeMapper) Map ¶
func (J JSONTypeMapper) Map(data any) DataType
Map maps underlying data type into corresponding JSON data type.
type Mapper ¶
Mapper is entity that has ability to map data's type into corresponding DataType of given format.
type YAMLTypeMapper ¶
type YAMLTypeMapper struct{}
YAMLTypeMapper is entity that has ability to map underlying data type into corresponding YAML data type.
func NewYAMLTypeMapper ¶
func NewYAMLTypeMapper() YAMLTypeMapper
func (YAMLTypeMapper) Map ¶
func (Y YAMLTypeMapper) Map(data any) DataType
Map maps underlying data type into corresponding YAML data type.