serializer

package
v0.0.0-...-1d97044 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(t SerializerType, serializer *Serializer) *errorAVA.Error

Types

type Factory

type Factory map[SerializerType]*Serializer

func GetInstance

func GetInstance() *Factory

func (Factory) Register

func (s Factory) Register(t SerializerType, serializer *Serializer) *errorAVA.Error

func (Factory) SerializerFactory

func (s Factory) SerializerFactory(t SerializerType) (*Serializer, *errorAVA.Error)

type HCL

type HCL struct {
}

func (*HCL) Deserializer

func (h *HCL) Deserializer(data []byte, out interface{}) *errorAVA.Error

func (*HCL) Serializer

func (h *HCL) Serializer(data interface{}) ([]byte, *errorAVA.Error)

func (*HCL) String

func (h *HCL) String() string

func (*HCL) Type

func (h *HCL) Type() SerializerType

type JSON

type JSON struct {
}

func (*JSON) Deserializer

func (j *JSON) Deserializer(data []byte, out interface{}) *errorAVA.Error

func (*JSON) Serializer

func (j *JSON) Serializer(data interface{}) ([]byte, *errorAVA.Error)

func (*JSON) String

func (j *JSON) String() string

func (*JSON) Type

func (j *JSON) Type() SerializerType

type Serializer

type Serializer struct {
}

func GetSerializer

func GetSerializer(t SerializerType) *Serializer

func (*Serializer) Deserializer

func (h *Serializer) Deserializer(data []byte, out interface{}) *errorAVA.Error

func (*Serializer) Serializer

func (h *Serializer) Serializer(data interface{}) ([]byte, *errorAVA.Error)

func (*Serializer) String

func (h *Serializer) String() string

func (*Serializer) Type

func (h *Serializer) Type() SerializerType

type SerializerI

type SerializerI interface {
	Serializer(interface{}) ([]byte, *errorAVA.Error)
	Deserializer([]byte, interface{}) *errorAVA.Error
	String() string
	Type() SerializerType
}

type SerializerType

type SerializerType int32

SerializerType x ENUM( json xml yaml toml hcl proto unknown )

const (
	// SerializerTypeJson is a SerializerType of type Json
	SerializerTypeJson SerializerType = iota
	// SerializerTypeXml is a SerializerType of type Xml
	SerializerTypeXml
	// SerializerTypeYaml is a SerializerType of type Yaml
	SerializerTypeYaml
	// SerializerTypeToml is a SerializerType of type Toml
	SerializerTypeToml
	// SerializerTypeHcl is a SerializerType of type Hcl
	SerializerTypeHcl
	// SerializerTypeProto is a SerializerType of type Proto
	SerializerTypeProto
	// SerializerTypeUnknown is a SerializerType of type Unknown
	SerializerTypeUnknown
)

func ParseSerializerType

func ParseSerializerType(name string) (SerializerType, *errorAVA.Error)

ParseSerializerType attempts to convert a string to a SerializerType

func (SerializerType) MarshalText

func (x SerializerType) MarshalText() ([]byte, *errorAVA.Error)

MarshalText implements the text marshaller method

func (SerializerType) String

func (x SerializerType) String() string

String implements the Stringer interface.

func (SerializerType) UnmarshalText

func (x SerializerType) UnmarshalText(text []byte) (SerializerType, *errorAVA.Error)

UnmarshalText implements the text unmarshaller method

type TOML

type TOML struct {
}

func (*TOML) Deserializer

func (t *TOML) Deserializer(data []byte, out interface{}) *errorAVA.Error

func (*TOML) Serializer

func (t *TOML) Serializer(data interface{}) (out []byte, err *errorAVA.Error)

func (*TOML) String

func (t *TOML) String() string

func (*TOML) Type

func (t *TOML) Type() SerializerType

type XML

type XML struct {
}

func (*XML) Deserializer

func (x *XML) Deserializer(data []byte, out interface{}) *errorAVA.Error

func (*XML) Serializer

func (x *XML) Serializer(data interface{}) ([]byte, *errorAVA.Error)

func (*XML) String

func (x *XML) String() string

func (*XML) Type

func (x *XML) Type() SerializerType

type YAML

type YAML struct {
}

func (*YAML) Deserializer

func (y *YAML) Deserializer(data []byte, out interface{}) *errorAVA.Error

func (*YAML) Serializer

func (y *YAML) Serializer(data interface{}) ([]byte, *errorAVA.Error)

func (*YAML) String

func (y *YAML) String() string

func (*YAML) Type

func (y *YAML) Type() SerializerType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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