mappers

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetadataMapper

func NewMetadataMapper() types.Mapper

func ValidateField

func ValidateField(field string, schema *types.Schema) error

func ValidateFields

func ValidateFields(schemas *types.Schema, fields ...string) error

Types

type Access

type Access struct {
	Fields   map[string]string
	Optional bool
}

func (Access) FromInternal

func (e Access) FromInternal(data map[string]interface{})

func (Access) ModifySchema

func (e Access) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (Access) ToInternal

func (e Access) ToInternal(data map[string]interface{}) error

type AliasField

type AliasField struct {
	Field string
	Names []string
}

func NewAlias

func NewAlias(field string, names ...string) AliasField

func (AliasField) FromInternal

func (d AliasField) FromInternal(data map[string]interface{})

func (AliasField) ModifySchema

func (d AliasField) ModifySchema(schema *mapper.Schema, schemas *mapper.Schemas) error

func (AliasField) ToInternal

func (d AliasField) ToInternal(data map[string]interface{}) error

type AliasValue

type AliasValue struct {
	Field string
	Alias map[string][]string
}

func (AliasValue) FromInternal

func (d AliasValue) FromInternal(data map[string]interface{})

func (AliasValue) ModifySchema

func (d AliasValue) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (AliasValue) ToInternal

func (d AliasValue) ToInternal(data map[string]interface{}) error

type AnnotationField

type AnnotationField struct {
	Field            string
	Object           bool
	List             bool
	IgnoreDefinition bool
}

func (AnnotationField) FromInternal

func (e AnnotationField) FromInternal(data map[string]interface{})

func (AnnotationField) ModifySchema

func (e AnnotationField) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (AnnotationField) ToInternal

func (e AnnotationField) ToInternal(data map[string]interface{}) error

type Base64

type Base64 struct {
	Field            string
	IgnoreDefinition bool
	Separator        string
}

func (Base64) FromInternal

func (m Base64) FromInternal(data map[string]interface{})

func (Base64) ModifySchema

func (m Base64) ModifySchema(s *mapper.Schema, schemas *mapper.Schemas) error

func (Base64) ToInternal

func (m Base64) ToInternal(data map[string]interface{}) error

type BatchMove

type BatchMove struct {
	From              []string
	To                string
	DestDefined       bool
	NoDeleteFromField bool
	// contains filtered or unexported fields
}

func (*BatchMove) FromInternal

func (b *BatchMove) FromInternal(data map[string]interface{})

func (*BatchMove) ModifySchema

func (b *BatchMove) ModifySchema(s *types.Schema, schemas *types.Schemas) error

func (*BatchMove) ToInternal

func (b *BatchMove) ToInternal(data map[string]interface{}) error

type Bytes

type Bytes struct {
	Field string
}

func (Bytes) FromInternal

func (d Bytes) FromInternal(data map[string]interface{})

func (Bytes) ModifySchema

func (d Bytes) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (Bytes) ToInternal

func (d Bytes) ToInternal(data map[string]interface{}) error

type ChangeType

type ChangeType struct {
	Field string
	Type  string
}

func (ChangeType) FromInternal

func (c ChangeType) FromInternal(data map[string]interface{})

func (ChangeType) ModifySchema

func (c ChangeType) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (ChangeType) ToInternal

func (c ChangeType) ToInternal(data map[string]interface{}) error

type Condition

type Condition struct {
	Field  string
	Value  interface{}
	Mapper types.Mapper
}

func (Condition) FromInternal

func (m Condition) FromInternal(data map[string]interface{})

func (Condition) ModifySchema

func (m Condition) ModifySchema(s *types.Schema, schemas *types.Schemas) error

func (Condition) ToInternal

func (m Condition) ToInternal(data map[string]interface{}) error

type Copy

type Copy struct {
	From, To string
}

func (Copy) FromInternal

func (c Copy) FromInternal(data map[string]interface{})

func (Copy) ModifySchema

func (c Copy) ModifySchema(s *types.Schema, schemas *types.Schemas) error

func (Copy) ToInternal

func (c Copy) ToInternal(data map[string]interface{}) error

type DefaultMapper

type DefaultMapper struct {
	Field string
}

func (DefaultMapper) FromInternal

func (d DefaultMapper) FromInternal(data map[string]interface{})

func (DefaultMapper) ModifySchema

func (d DefaultMapper) ModifySchema(schema *mapper.Schema, schemas *mapper.Schemas) error

func (DefaultMapper) ToInternal

func (d DefaultMapper) ToInternal(data map[string]interface{}) error

type DefaultMissing

type DefaultMissing struct {
	Field   string
	Default interface{}
}

func (DefaultMissing) FromInternal

func (d DefaultMissing) FromInternal(data map[string]interface{})

func (DefaultMissing) ModifySchema

func (d DefaultMissing) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (DefaultMissing) ToInternal

func (d DefaultMissing) ToInternal(data map[string]interface{}) error

type DisplayName

type DisplayName struct {
}

func (DisplayName) FromInternal

func (d DisplayName) FromInternal(data map[string]interface{})

func (DisplayName) ModifySchema

func (d DisplayName) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (DisplayName) ToInternal

func (d DisplayName) ToInternal(data map[string]interface{}) error

type Drop

type Drop struct {
	Field            string
	IgnoreDefinition bool
}

func (Drop) FromInternal

func (d Drop) FromInternal(data map[string]interface{})

func (Drop) ModifySchema

func (d Drop) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (Drop) ToInternal

func (d Drop) ToInternal(data map[string]interface{}) error

type Embed

type Embed struct {
	Field    string
	Optional bool
	ReadOnly bool
	Ignore   []string

	EmptyValueOk bool
	// contains filtered or unexported fields
}

func (*Embed) FromInternal

func (e *Embed) FromInternal(data map[string]interface{})

func (*Embed) ModifySchema

func (e *Embed) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (*Embed) ToInternal

func (e *Embed) ToInternal(data map[string]interface{}) error

type Enum

type Enum struct {
	Field   string
	Options []string
}

func (Enum) FromInternal

func (e Enum) FromInternal(data map[string]interface{})

func (Enum) ModifySchema

func (e Enum) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (Enum) ToInternal

func (e Enum) ToInternal(data map[string]interface{}) error

type JSONEncode

type JSONEncode struct {
	Field            string
	IgnoreDefinition bool
	Separator        string
}

func (JSONEncode) FromInternal

func (m JSONEncode) FromInternal(data map[string]interface{})

func (JSONEncode) ModifySchema

func (m JSONEncode) ModifySchema(s *types.Schema, schemas *types.Schemas) error

func (JSONEncode) ToInternal

func (m JSONEncode) ToInternal(data map[string]interface{}) error

type JSONKeys

type JSONKeys struct {
}

func (JSONKeys) FromInternal

func (d JSONKeys) FromInternal(data map[string]interface{})

func (JSONKeys) ModifySchema

func (d JSONKeys) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (JSONKeys) ToInternal

func (d JSONKeys) ToInternal(data map[string]interface{}) error

type LabelField

type LabelField struct {
	Field string
}

func (LabelField) FromInternal

func (e LabelField) FromInternal(data map[string]interface{})

func (LabelField) ModifySchema

func (e LabelField) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (LabelField) ToInternal

func (e LabelField) ToInternal(data map[string]interface{}) error

type MapToSlice

type MapToSlice struct {
	Field string
	Sep   string
}

func (MapToSlice) FromInternal

func (d MapToSlice) FromInternal(data map[string]interface{})

func (MapToSlice) ModifySchema

func (d MapToSlice) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (MapToSlice) ToInternal

func (d MapToSlice) ToInternal(data map[string]interface{}) error

type MaybeStringer

type MaybeStringer interface {
	MaybeString() interface{}
}

type Move

type Move struct {
	From, To, CodeName string
	DestDefined        bool
	NoDeleteFromField  bool
}

func (Move) FromInternal

func (m Move) FromInternal(data map[string]interface{})

func (Move) ModifySchema

func (m Move) ModifySchema(s *mapper.Schema, schemas *mapper.Schemas) error

func (Move) ToInternal

func (m Move) ToInternal(data map[string]interface{}) error

type Namespaced

type Namespaced struct {
	IfNot   bool
	Mappers []types.Mapper
	// contains filtered or unexported fields
}

func (*Namespaced) FromInternal

func (s *Namespaced) FromInternal(data map[string]interface{})

func (*Namespaced) ModifySchema

func (s *Namespaced) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (*Namespaced) ToInternal

func (s *Namespaced) ToInternal(data map[string]interface{}) error

type Object

type Object struct {
	types.Mappers
}

func NewObject

func NewObject(mappers ...types.Mapper) Object

type ObjectsToSlice

type ObjectsToSlice struct {
	Field     string
	NewObject StringerFactory
	ToObject  ToObject
}

func (ObjectsToSlice) FromInternal

func (p ObjectsToSlice) FromInternal(data map[string]interface{})

func (ObjectsToSlice) ModifySchema

func (p ObjectsToSlice) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (ObjectsToSlice) ToInternal

func (p ObjectsToSlice) ToInternal(data map[string]interface{}) error

type PendingStatus

type PendingStatus struct {
}

func (PendingStatus) FromInternal

func (s PendingStatus) FromInternal(data map[string]interface{})

func (PendingStatus) ModifySchema

func (s PendingStatus) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (PendingStatus) ToInternal

func (s PendingStatus) ToInternal(data map[string]interface{}) error

type ReadOnly

type ReadOnly struct {
	Field     string
	Optional  bool
	SubFields bool
}

func (ReadOnly) FromInternal

func (r ReadOnly) FromInternal(data map[string]interface{})

func (ReadOnly) ModifySchema

func (r ReadOnly) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (ReadOnly) ToInternal

func (r ReadOnly) ToInternal(data map[string]interface{}) error

type Required

type Required struct {
	Fields []string
}

func (Required) FromInternal

func (e Required) FromInternal(data map[string]interface{})

func (Required) ModifySchema

func (e Required) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (Required) ToInternal

func (e Required) ToInternal(data map[string]interface{}) error

type Root

type Root struct {
	Mapper types.Mapper
	// contains filtered or unexported fields
}

func (*Root) FromInternal

func (m *Root) FromInternal(data map[string]interface{})

func (*Root) ModifySchema

func (m *Root) ModifySchema(s *types.Schema, schemas *types.Schemas) error

func (*Root) ToInternal

func (m *Root) ToInternal(data map[string]interface{}) error

type SetValue

type SetValue struct {
	Field         string
	InternalValue interface{}
	ExternalValue interface{}
}

func (SetValue) FromInternal

func (d SetValue) FromInternal(data map[string]interface{})

func (SetValue) ModifySchema

func (d SetValue) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (SetValue) ToInternal

func (d SetValue) ToInternal(data map[string]interface{}) error

type Shlex

type Shlex struct {
	Field string
}

func (Shlex) FromInternal

func (d Shlex) FromInternal(data map[string]interface{})

func (Shlex) ModifySchema

func (d Shlex) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (Shlex) ToInternal

func (d Shlex) ToInternal(data map[string]interface{}) error

type SingleSlice

type SingleSlice struct {
	Field           string
	DontForceString bool
}

func (SingleSlice) FromInternal

func (d SingleSlice) FromInternal(data map[string]interface{})

func (SingleSlice) ModifySchema

func (d SingleSlice) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (SingleSlice) ToInternal

func (d SingleSlice) ToInternal(data map[string]interface{}) error

type SliceMerge

type SliceMerge struct {
	From             []string
	To               string
	IgnoreDefinition bool
}

func (SliceMerge) FromInternal

func (s SliceMerge) FromInternal(data map[string]interface{})

func (SliceMerge) ModifySchema

func (s SliceMerge) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (SliceMerge) ToInternal

func (s SliceMerge) ToInternal(data map[string]interface{}) error

type SliceToMap

type SliceToMap struct {
	Field string
	Key   string
}

func (SliceToMap) FromInternal

func (s SliceToMap) FromInternal(data map[string]interface{})

func (SliceToMap) ModifySchema

func (s SliceToMap) ModifySchema(schema *types.Schema, schemas *types.Schemas) error

func (SliceToMap) ToInternal

func (s SliceToMap) ToInternal(data map[string]interface{}) error

type StringerFactory

type StringerFactory func() MaybeStringer

type ToObject

type ToObject func(interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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