Documentation
¶
Overview ¶
Package resolver determines field mappings between struct types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Errors ¶
type Errors []Error
Errors is a collection of resolution errors.
type FieldMapping ¶
type FieldMapping struct {
// SourceField is the source field name
SourceField string
// TargetField is the target field name
TargetField string
// SourceType is the source field type
SourceType types.Type
// TargetType is the target field type
TargetType types.Type
// Kind indicates the type of mapping
Kind MappingKind
// Converter is the converter to use (for KindConverter)
Converter *registry.Converter
// NestedMapper is the generated mapper function name (for KindNested)
NestedMapper string
// HasError indicates if this mapping may produce an error
HasError bool
}
FieldMapping describes how to map a source field to a target field.
type Mapping ¶
type Mapping struct {
Source *analyzer.StructInfo
Target *analyzer.StructInfo
Fields []FieldMapping
HasError bool // true if any field mapping may produce an error
}
Mapping holds the complete mapping between two struct types.
type MappingKind ¶
type MappingKind int
MappingKind indicates the type of field mapping.
const ( // KindDirect is a direct copy (same name, same type). KindDirect MappingKind = iota // KindConverter uses a registered converter. KindConverter // KindNested uses a generated nested mapper. KindNested // KindSlice maps slice elements. KindSlice // KindIgnore ignores the field (map:"-" or target-only field). KindIgnore )
Click to show internal directories.
Click to hide internal directories.