xentity

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 3 Imported by: 0

README

xentity

References
  • xslice
  • xcondition*
  • xtesting*
Functions
  • type EntityMappers struct {}
  • type EntityMapper struct {}
  • type MapFunc func(from interface{}, to interface{}) error
  • New() *EntityMappers
  • NewMapper(from interface{}, ctor func() interface{}, mapFunc MapFunc) *EntityMapper
  • (e *EntityMappers) AddMapper(mapper *EntityMapper)
  • (e *EntityMappers) AddMappers(mappers ...*EntityMapper)
  • (e *EntityMapper) GetMapFunc() MapFunc
  • (e *EntityMappers) GetMapper(from interface{}, to interface{}) (*EntityMapper, error)
  • (e *EntityMappers) MapProp(from interface{}, to interface{}, options ...MapFunc) error
  • (e *EntityMappers) Map(from interface{}, toModel interface{}, options ...MapFunc) (interface{}, error)
  • (e *EntityMappers) MapSlice(from interface{}, toModel interface{}, options ...MapFunc) (interface{}, error)
  • (e *EntityMappers) MustMapProp(from interface{}, to interface{}, options ...MapFunc)
  • (e *EntityMappers) MustMap(from interface{}, toModel interface{}, options ...MapFunc) interface{}
  • (e *EntityMappers) MustMapSlice(from interface{}, toModel interface{}, options ...MapFunc) interface{}
  • AddMapper(mapper *EntityMapper)
  • AddMappers(mappers ...*EntityMapper)
  • GetMapper(from interface{}, to interface{}) (*EntityMapper, error)
  • MapProp(from interface{}, to interface{}, options ...MapFunc) error
  • Map(from interface{}, to interface{}, options ...MapFunc) (interface{}, error)
  • MapSlice(from interface{}, to interface{}, options ...MapFunc) (interface{}, error)
  • MustMapProp(from interface{}, to interface{}, options ...MapFunc)
  • MustMap(from interface{}, to interface{}, options ...MapFunc) interface{}
  • MustMapSlice(from interface{}, to interface{}, options ...MapFunc) interface{}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMapper

func AddMapper(mapper *EntityMapper)

AddMapper adds an EntityMapper to EntityMappers.

func AddMappers

func AddMappers(mappers ...*EntityMapper)

AddMappers adds some EntityMapper to EntityMappers.

func Map

func Map(from interface{}, to interface{}, options ...MapFunc) (interface{}, error)

Map generates a `to` from `from`.

func MapProp

func MapProp(from interface{}, to interface{}, options ...MapFunc) error

MapProp maps properties from `from` to `to`.

func MapSlice

func MapSlice(from interface{}, to interface{}, options ...MapFunc) (interface{}, error)

MapSlice generates a `to` slice from `from` slice.

func MustMap

func MustMap(from interface{}, to interface{}, options ...MapFunc) interface{}

Map is the must version of MapProp, panic if error.

func MustMapProp

func MustMapProp(from interface{}, to interface{}, options ...MapFunc)

MustMapProp is the must version of MapProp, panic if error.

func MustMapSlice

func MustMapSlice(from interface{}, to interface{}, options ...MapFunc) interface{}

MapSlice is the must version of MapProp, panic if error.

Types

type EntityMapper

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

EntityMapper represents an entity mapper.

func GetMapper

func GetMapper(from interface{}, to interface{}) (*EntityMapper, error)

GetMapper returns the EntityMapper from EntityMappers.

func NewMapper

func NewMapper(from interface{}, ctor func() interface{}, mapFunc MapFunc) *EntityMapper

NewMapper creates a EntityMapper.

func (*EntityMapper) GetMapFunc added in v1.4.3

func (e *EntityMapper) GetMapFunc() MapFunc

GetMapFunc returns the MapFunc from EntityMapper.

type EntityMappers

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

EntityMappers represents an entity mappers container.

func New

func New() *EntityMappers

New creates a EntityMappers.

func (*EntityMappers) AddMapper

func (e *EntityMappers) AddMapper(m *EntityMapper)

AddMapper adds an EntityMapper to EntityMappers.

func (*EntityMappers) AddMappers

func (e *EntityMappers) AddMappers(ms ...*EntityMapper)

AddMappers adds some EntityMapper to EntityMappers.

func (*EntityMappers) GetMapper

func (e *EntityMappers) GetMapper(from interface{}, to interface{}) (*EntityMapper, error)

GetMapper returns the EntityMapper from EntityMappers.

func (*EntityMappers) Map

func (e *EntityMappers) Map(from interface{}, toModel interface{}, options ...MapFunc) (interface{}, error)

Map generates a `to` from `from`.

func (*EntityMappers) MapProp

func (e *EntityMappers) MapProp(from interface{}, to interface{}, options ...MapFunc) error

MapProp maps properties from `from` to `to`.

func (*EntityMappers) MapSlice

func (e *EntityMappers) MapSlice(fromInterface interface{}, toModel interface{}, options ...MapFunc) (interface{}, error)

MapSlice generates a `to` slice from `from` slice.

func (*EntityMappers) MustMap

func (e *EntityMappers) MustMap(from interface{}, toModel interface{}, options ...MapFunc) interface{}

Map is the must version of MapProp, panic if error.

func (*EntityMappers) MustMapProp

func (e *EntityMappers) MustMapProp(from interface{}, to interface{}, options ...MapFunc)

MustMapProp is the must version of MapProp, panic if error.

func (*EntityMappers) MustMapSlice

func (e *EntityMappers) MustMapSlice(from interface{}, toModel interface{}, options ...MapFunc) interface{}

MapSlice is the must version of MapProp, panic if error.

type MapFunc

type MapFunc func(from interface{}, to interface{}) error

MapFunc represents a model mapping method, describe how to map model from `from` to `to`.

Jump to

Keyboard shortcuts

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