Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mapper ¶
type Mapper struct {
//key is Go Type name, value is mapping configuration
Mappings map[string]Mapping
// contains filtered or unexported fields
}
Mapper defines rules on how to map a Go Type to a model.Resource
func (Mapper) FetchResources ¶
FetchResources calls the implementation method on each Mapping and returns the resources
type Mapping ¶
type Mapping struct {
Type string `yaml:"type"`
//optional: if the Resource Type is different that the Golang type
ResourceType string `yaml:"resourceType"`
//optional: if the ID field is not called 'Id'
IdField string `default:"Id" yaml:"idField"`
//optional: override the TagField from MappingConfig
TagField TagField `yaml:"tagField"`
//optional: override the IgnoredFields from MappingConfig
IgnoredFields []string `yaml:"ignoredFields"`
//method implementating fetching the resources, the provider must implement it
Impl string `yaml:"impl"`
//the method is found at runtime using Impl
Method *reflect.Value
//optional: method implementating fetching the tags, only needed if there is not a field containing tags
TagImpl string `yaml:"tagImpl"`
//the method is found at runtime using TagImpl
TagMethod *reflect.Value
}
Click to show internal directories.
Click to hide internal directories.