Documentation ¶
Index ¶
- Variables
- type ComponentConfig
- func NewComponentConfigFromDescriptor(descriptor *refer.Descriptor, config *config.ConfigParams) *ComponentConfig
- func NewComponentConfigFromType(typ *reflect.TypeDescriptor, config *config.ConfigParams) *ComponentConfig
- func ReadComponentConfigFromConfig(config *config.ConfigParams) (result *ComponentConfig, err error)
- type ContainerConfig
- type TContainerConfigReader
- func (c *TContainerConfigReader) ReadFromFile(correlationId string, path string, parameters *config.ConfigParams) (ContainerConfig, error)
- func (c *TContainerConfigReader) ReadFromJsonFile(correlationId string, path string, parameters *config.ConfigParams) (ContainerConfig, error)
- func (c *TContainerConfigReader) ReadFromYamlFile(correlationId string, path string, parameters *config.ConfigParams) (ContainerConfig, error)
Constants ¶
This section is empty.
Variables ¶
var ContainerConfigReader = &TContainerConfigReader{}
Functions ¶
This section is empty.
Types ¶
type ComponentConfig ¶
type ComponentConfig struct { Descriptor *refer.Descriptor Type *reflect.TypeDescriptor Config *config.ConfigParams }
Configuration of a component inside a container.
The configuration includes type information or descriptor, and component configuration parameters.
func NewComponentConfigFromDescriptor ¶
func NewComponentConfigFromDescriptor(descriptor *refer.Descriptor, config *config.ConfigParams) *ComponentConfig
Creates a new instance of the component configuration. Parameters:
- descriptor *refer.Descriptor a components descriptor (locator).
- config *config.ConfigParams component configuration parameters.
Returns *ComponentConfig
func NewComponentConfigFromType ¶
func NewComponentConfigFromType(typ *reflect.TypeDescriptor, config *config.ConfigParams) *ComponentConfig
Creates a new instance of the component configuration. Parameters:
- typ *reflect.TypeDescriptor a components type descriptor.
- config *config.ConfigParams component configuration parameters.
Returns *ComponentConfig
func ReadComponentConfigFromConfig ¶
func ReadComponentConfigFromConfig(config *config.ConfigParams) (result *ComponentConfig, err error)
Creates a new instance of ComponentConfig based on section from container configuration. Parameters:
- config *config.ConfigParams component parameters from container configuration
Returns *ComponentConfig, error a newly created ComponentConfig and ConfigError when neither component descriptor or type is found.
type ContainerConfig ¶
type ContainerConfig []*ComponentConfig
Container configuration defined as a list of component configurations.
func NewContainerConfig ¶
func NewContainerConfig(components ...*ComponentConfig) ContainerConfig
Creates a new instance of container configuration. Parameters:
- components *ComponentConfig a list of component configurations.
Returns ContainerConfig
func NewContainerConfigFromValue ¶
func NewContainerConfigFromValue(value interface{}) ContainerConfig
Creates a new ContainerConfig object filled with key-value pairs from specified object. The value is converted into ConfigParams object which is used to create the object. see fromConfig Parameters:
- value interface{} an object with key-value pairs used to initialize a new ContainerConfig.
Returns ContainerConfig a new ContainerConfig object.
func ReadContainerConfigFromConfig ¶
func ReadContainerConfigFromConfig(config *config.ConfigParams) (ContainerConfig, error)
Creates a new ContainerConfig object based on configuration parameters. Each section in the configuration parameters is converted into a component configuration. Parameters:
- config *config.ConfigParams Returns ContainerConfig, error
a new ContainerConfig object and error
type TContainerConfigReader ¶
type TContainerConfigReader struct{}
Helper class that reads container configuration from JSON or YAML file.
func (*TContainerConfigReader) ReadFromFile ¶
func (c *TContainerConfigReader) ReadFromFile(correlationId string, path string, parameters *config.ConfigParams) (ContainerConfig, error)
Reads container configuration from JSON or YAML file. The type of the file is determined by file extension. Parameters:
- correlationId string transaction id to trace execution through call chain.
- path string a path to component configuration file.
- parameters *config.ConfigParams values to parameters the configuration or null to skip parameterization.
Returns ContainerConfig, error the read container configuration and error
func (*TContainerConfigReader) ReadFromJsonFile ¶
func (c *TContainerConfigReader) ReadFromJsonFile(correlationId string, path string, parameters *config.ConfigParams) (ContainerConfig, error)
Reads container configuration from JSON file. Parameters:
- correlationId string transaction id to trace execution through call chain.
- path string a path to component configuration file.
- parameters *config.ConfigParams values to parameters the configuration or null to skip parameterization.
Returns ContainerConfig, error the read container configuration and error
func (*TContainerConfigReader) ReadFromYamlFile ¶
func (c *TContainerConfigReader) ReadFromYamlFile(correlationId string, path string, parameters *config.ConfigParams) (ContainerConfig, error)
Reads container configuration from YAML file. Parameters:
- correlationId string transaction id to trace execution through call chain.
- path string a path to component configuration file.
- parameters *config.ConfigParams values to parameters the configuration or null to skip parameterization.
Returns ContainerConfig, error the read container configuration and error