mappers

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAlias

func NewAlias(field string, names ...string) types.Mapper

func NewEnum

func NewEnum(field string, vals ...string) schemas.Mapper

func NewMetadataMapper

func NewMetadataMapper() types.Mapper

func ValidateField

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

Types

type Access

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

func (Access) FromInternal

func (e Access) FromInternal(data data.Object)

func (Access) ModifySchema

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

func (Access) ToInternal

func (e Access) ToInternal(data data.Object) error

type AliasField

type AliasField struct {
	Field string
	Names []string
}

func (AliasField) FromInternal

func (d AliasField) FromInternal(data data.Object)

func (AliasField) ModifySchema

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

func (AliasField) ToInternal

func (d AliasField) ToInternal(data data.Object) 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 data.Object)

func (DefaultMapper) ModifySchema

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

func (DefaultMapper) ToInternal

func (d DefaultMapper) ToInternal(data data.Object) error

type Drop

type Drop struct {
	Field    string
	Optional bool
}

func (Drop) FromInternal

func (d Drop) FromInternal(data data.Object)

func (Drop) ModifySchema

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

func (Drop) ToInternal

func (d Drop) ToInternal(data data.Object) 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 data.Object)

func (*Embed) ModifySchema

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

func (*Embed) ToInternal

func (e *Embed) ToInternal(data data.Object) error

type EmptyMapper

type EmptyMapper struct {
}

func (*EmptyMapper) FromInternal

func (e *EmptyMapper) FromInternal(data data.Object)

func (*EmptyMapper) ModifySchema

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

func (*EmptyMapper) ToInternal

func (e *EmptyMapper) ToInternal(data data.Object) error

type Enum

type Enum struct {
	DefaultMapper
	// contains filtered or unexported fields
}

func (*Enum) FromInternal

func (d *Enum) FromInternal(data data.Object)

func (*Enum) ToInternal

func (d *Enum) ToInternal(data data.Object) error

type Exists

type Exists struct {
	Field  string
	Mapper types.Mapper
	// contains filtered or unexported fields
}

func (*Exists) FromInternal

func (m *Exists) FromInternal(data data.Object)

func (*Exists) ModifySchema

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

func (*Exists) ToInternal

func (m *Exists) ToInternal(data data.Object) error

type JSONKeys

type JSONKeys struct {
}

func (JSONKeys) FromInternal

func (d JSONKeys) FromInternal(data data.Object)

func (JSONKeys) ModifySchema

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

func (JSONKeys) ToInternal

func (d JSONKeys) ToInternal(data data.Object) error

type Move

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

func (Move) FromInternal

func (m Move) FromInternal(d data.Object)

func (Move) ModifySchema

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

func (Move) ToInternal

func (m Move) ToInternal(d data.Object) error

type SetValue

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

func (SetValue) FromInternal

func (d SetValue) FromInternal(data data.Object)

func (SetValue) ModifySchema

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

func (SetValue) ToInternal

func (d SetValue) ToInternal(data data.Object) error

type SliceToMap

type SliceToMap struct {
	Field string
	Key   string
}

func (SliceToMap) FromInternal

func (s SliceToMap) FromInternal(data data.Object)

func (SliceToMap) ModifySchema

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

func (SliceToMap) ToInternal

func (s SliceToMap) ToInternal(data data.Object) error

Jump to

Keyboard shortcuts

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