codec

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DDMMYYYY         = regexp.MustCompile(`^\d{4}\-\d{2}\-\d{2}$`)
	DDMMYYYYHHMMSS   = regexp.MustCompile(`^\d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}:\d{2}$`)
	DDMMYYYYHHMMSSTZ = regexp.MustCompile(`^\d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}:\d{2}\.\d+$`)
)

date format :

View Source
var (
	DefaultRegistry = buildDefaultRegistry()
)

DefaultMapper :

Functions

func NilEncoder

func NilEncoder(_ reflext.StructFielder, _ reflect.Value) (interface{}, error)

NilEncoder :

Types

type Codecer added in v1.0.2

type Codecer interface {
	RegisterTypeCodec(t reflect.Type, enc ValueEncoder, dec ValueDecoder)
	RegisterTypeEncoder(t reflect.Type, enc ValueEncoder)
	RegisterTypeDecoder(t reflect.Type, dec ValueDecoder)
	RegisterKindEncoder(k reflect.Kind, enc ValueEncoder)
	RegisterKindDecoder(k reflect.Kind, dec ValueDecoder)
	LookupEncoder(v reflect.Value) (ValueEncoder, error)
	LookupDecoder(t reflect.Type) (ValueDecoder, error)
}

Codecer :

type DefaultDecoders

type DefaultDecoders struct {
	// contains filtered or unexported fields
}

DefaultDecoders :

func (DefaultDecoders) DecodeArray

func (dec DefaultDecoders) DecodeArray(it interface{}, v reflect.Value) error

DecodeArray :

func (DefaultDecoders) DecodeBool

func (dec DefaultDecoders) DecodeBool(it interface{}, v reflect.Value) error

DecodeBool :

func (DefaultDecoders) DecodeByte

func (dec DefaultDecoders) DecodeByte(it interface{}, v reflect.Value) error

DecodeByte :

func (DefaultDecoders) DecodeCivilDate added in v1.3.0

func (dec DefaultDecoders) DecodeCivilDate(it interface{}, v reflect.Value) error

DecodeCivilDate :

func (DefaultDecoders) DecodeCurrency

func (dec DefaultDecoders) DecodeCurrency(it interface{}, v reflect.Value) error

DecodeCurrency :

func (DefaultDecoders) DecodeFloat

func (dec DefaultDecoders) DecodeFloat(it interface{}, v reflect.Value) error

DecodeFloat :

func (DefaultDecoders) DecodeInt

func (dec DefaultDecoders) DecodeInt(it interface{}, v reflect.Value) error

DecodeInt :

func (DefaultDecoders) DecodeJSONRaw

func (dec DefaultDecoders) DecodeJSONRaw(it interface{}, v reflect.Value) error

DecodeJSONRaw :

func (DefaultDecoders) DecodeLanguage

func (dec DefaultDecoders) DecodeLanguage(it interface{}, v reflect.Value) error

DecodeLanguage :

func (DefaultDecoders) DecodeLineString

func (dec DefaultDecoders) DecodeLineString(it interface{}, v reflect.Value) error

DecodeLineString :

func (DefaultDecoders) DecodeMap

func (dec DefaultDecoders) DecodeMap(it interface{}, v reflect.Value) error

DecodeMap :

func (DefaultDecoders) DecodePoint

func (dec DefaultDecoders) DecodePoint(it interface{}, v reflect.Value) error

DecodePoint :

func (*DefaultDecoders) DecodePtr

func (dec *DefaultDecoders) DecodePtr(it interface{}, v reflect.Value) error

DecodePtr :

func (DefaultDecoders) DecodeRawBytes

func (dec DefaultDecoders) DecodeRawBytes(it interface{}, v reflect.Value) error

DecodeRawBytes :

func (DefaultDecoders) DecodeString

func (dec DefaultDecoders) DecodeString(it interface{}, v reflect.Value) error

DecodeString :

func (*DefaultDecoders) DecodeStruct

func (dec *DefaultDecoders) DecodeStruct(it interface{}, v reflect.Value) error

DecodeStruct :

func (DefaultDecoders) DecodeTime

func (dec DefaultDecoders) DecodeTime(it interface{}, v reflect.Value) error

DecodeTime :

func (DefaultDecoders) DecodeUint

func (dec DefaultDecoders) DecodeUint(it interface{}, v reflect.Value) error

DecodeUint :

type DefaultEncoders

type DefaultEncoders struct {
	// contains filtered or unexported fields
}

DefaultEncoders :

func (DefaultEncoders) EncodeArray

func (enc DefaultEncoders) EncodeArray(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeArray :

func (DefaultEncoders) EncodeBool

func (enc DefaultEncoders) EncodeBool(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeBool :

func (DefaultEncoders) EncodeByte

func (enc DefaultEncoders) EncodeByte(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeByte :

func (DefaultEncoders) EncodeFloat

func (enc DefaultEncoders) EncodeFloat(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeFloat :

func (DefaultEncoders) EncodeInt

func (enc DefaultEncoders) EncodeInt(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeInt :

func (DefaultEncoders) EncodeJSONRaw

func (enc DefaultEncoders) EncodeJSONRaw(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeJSONRaw :

func (DefaultEncoders) EncodeMap

func (enc DefaultEncoders) EncodeMap(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeMap :

func (*DefaultEncoders) EncodePtr

func (enc *DefaultEncoders) EncodePtr(sf reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodePtr :

func (DefaultEncoders) EncodeRawBytes

func (enc DefaultEncoders) EncodeRawBytes(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeRawBytes :

func (DefaultEncoders) EncodeSpatial

func (enc DefaultEncoders) EncodeSpatial(st spatial.Type) ValueEncoder

EncodeSpatial :

func (DefaultEncoders) EncodeString

func (enc DefaultEncoders) EncodeString(sf reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeString :

func (DefaultEncoders) EncodeStringer

func (enc DefaultEncoders) EncodeStringer(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeStringer :

func (DefaultEncoders) EncodeStruct

func (enc DefaultEncoders) EncodeStruct(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeStruct :

func (DefaultEncoders) EncodeTime

func (enc DefaultEncoders) EncodeTime(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeTime :

func (DefaultEncoders) EncodeUint

func (enc DefaultEncoders) EncodeUint(_ reflext.StructFielder, v reflect.Value) (interface{}, error)

EncodeUint :

type ErrNoDecoder

type ErrNoDecoder struct {
	Type reflect.Type
}

ErrNoDecoder :

func (ErrNoDecoder) Error

func (err ErrNoDecoder) Error() (msg string)

type ErrNoEncoder

type ErrNoEncoder struct {
	Type reflect.Type
}

ErrNoEncoder :

func (ErrNoEncoder) Error

func (err ErrNoEncoder) Error() (msg string)

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry :

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new empty Registry.

func (*Registry) LookupDecoder

func (r *Registry) LookupDecoder(t reflect.Type) (ValueDecoder, error)

LookupDecoder :

func (*Registry) LookupEncoder

func (r *Registry) LookupEncoder(v reflect.Value) (ValueEncoder, error)

LookupEncoder :

func (*Registry) RegisterKindCodec added in v1.1.1

func (r *Registry) RegisterKindCodec(k reflect.Kind, enc ValueEncoder, dec ValueDecoder)

RegisterKindCodec :

func (*Registry) RegisterKindDecoder added in v1.1.1

func (r *Registry) RegisterKindDecoder(k reflect.Kind, dec ValueDecoder)

RegisterKindDecoder :

func (*Registry) RegisterKindEncoder added in v1.1.1

func (r *Registry) RegisterKindEncoder(k reflect.Kind, enc ValueEncoder)

RegisterKindEncoder :

func (*Registry) RegisterTypeCodec added in v1.1.1

func (r *Registry) RegisterTypeCodec(t reflect.Type, enc ValueEncoder, dec ValueDecoder)

RegisterTypeCodec :

func (*Registry) RegisterTypeDecoder added in v1.1.1

func (r *Registry) RegisterTypeDecoder(t reflect.Type, dec ValueDecoder)

RegisterTypeDecoder :

func (*Registry) RegisterTypeEncoder added in v1.1.1

func (r *Registry) RegisterTypeEncoder(t reflect.Type, enc ValueEncoder)

RegisterTypeEncoder :

type ValueCodec

type ValueCodec interface {
	DecodeValue(interface{}, reflect.Value) error
	EncodeValue(reflect.Value) (interface{}, error)
}

ValueCodec :

type ValueDecoder

type ValueDecoder func(interface{}, reflect.Value) error

ValueDecoder :

type ValueEncoder

type ValueEncoder func(reflext.StructFielder, reflect.Value) (interface{}, error)

ValueEncoder :

Jump to

Keyboard shortcuts

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