Documentation ¶
Index ¶
- Constants
- func IGNORE() interface{}
- func NewFieldMapViaTemplate(src, dst reflect.Value, t Template) (SrcMap FieldMap, DstMap FieldMap)
- type Condition
- type ConditionHandler
- type Error
- type FieldMap
- func (fm FieldMap) Bool(identifier string) bool
- func (fm FieldMap) Bytes(identifier string) []byte
- func (fm FieldMap) Complex(identifier string) complex128
- func (fm FieldMap) Field(identifier string) reflect.Value
- func (fm FieldMap) Float(identifier string) float64
- func (fm FieldMap) Int(identifier string) int
- func (fm FieldMap) Int64(identifier string) int64
- func (fm FieldMap) Interface(identifier string) interface{}
- func (fm FieldMap) Mapping(SrcMap FieldMap, transformers map[string]TransformHandler)
- func (fm FieldMap) String(identifier string) string
- type GetTemplate
- type Ignore
- type MakeDestination
- type Mapper
- type Mapping
- type NameMapper
- func (nm *NameMapper) Condition(name string, conditionHandler ConditionHandler) Mapper
- func (nm *NameMapper) Ignore(name string) Mapper
- func (nm *NameMapper) MakeDestination(source interface{}) (interface{}, error)
- func (nm *NameMapper) Mapping(src interface{}, dst interface{}) (err error)
- func (nm *NameMapper) Nested(name, target string, mapper Mapper) Mapper
- func (nm *NameMapper) SetProfile(profile map[string]string) error
- func (nm *NameMapper) Template() Template
- func (nm *NameMapper) Transform(name string, handler TransformHandler) Mapper
- type Nested
- type Template
- type Transform
- type TransformHandler
Constants ¶
View Source
const TAG = "automapper"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Condition ¶
type Condition interface {
Condition(identifier string, conditionHandler ConditionHandler) Mapper
}
type ConditionHandler ¶
type Error ¶
type Error string
const ( DoesNotExist Error = "does not exist or is non-public field" IdentifierNotFound Error = "identifier not found" IsNilOrInvalid Error = "is nil or invalid" IsDifferentType Error = "is different type" InvalidMapper Error = "invalid mapper" InvalidParameter Error = "invalid parameter" UndefinedError Error = "undefined error" )
type FieldMap ¶
type FieldMap struct {
// contains filtered or unexported fields
}
func (FieldMap) Complex ¶
func (fm FieldMap) Complex(identifier string) complex128
type GetTemplate ¶
type GetTemplate interface {
Template() Template
}
type MakeDestination ¶
type MakeDestination interface {
MakeDestination(src interface{}) (interface{}, error)
}
type Mapper ¶
type Mapper interface { GetTemplate Mapping MakeDestination Transform Ignore Condition Nested }
type NameMapper ¶
type NameMapper struct {
// contains filtered or unexported fields
}
func NewNameMapper ¶
func NewNameMapper(template Template, profile map[string]string) (*NameMapper, error)
func (*NameMapper) Condition ¶
func (nm *NameMapper) Condition(name string, conditionHandler ConditionHandler) Mapper
func (*NameMapper) Ignore ¶
func (nm *NameMapper) Ignore(name string) Mapper
func (*NameMapper) MakeDestination ¶
func (nm *NameMapper) MakeDestination(source interface{}) (interface{}, error)
func (*NameMapper) Mapping ¶
func (nm *NameMapper) Mapping(src interface{}, dst interface{}) (err error)
func (*NameMapper) SetProfile ¶
func (nm *NameMapper) SetProfile(profile map[string]string) error
func (*NameMapper) Template ¶
func (nm *NameMapper) Template() Template
func (*NameMapper) Transform ¶
func (nm *NameMapper) Transform(name string, handler TransformHandler) Mapper
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func NewTemplate ¶
func NewTemplate(src, dst interface{}) Template
func (Template) ProfileSameName ¶
func (Template) ProfileSameTag ¶
type Transform ¶
type Transform interface {
Transform(identifier string, handler TransformHandler) Mapper
}
type TransformHandler ¶
type TransformHandler func(SrcMap FieldMap) interface{}
func FromField ¶
func FromField(target string) TransformHandler
Click to show internal directories.
Click to hide internal directories.