config

package
v0.0.1-3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContainerConfigReader = &_TContainerConfigReader{}

ContainerConfigReader Helper class that reads container configuration from JSON or YAML file.

Functions

This section is empty.

Types

type ComponentConfig

type ComponentConfig struct {
	Descriptor *refer.Descriptor
	Type       *reflect.TypeDescriptor
	Config     *config.ConfigParams
}

ComponentConfig 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

NewComponentConfigFromDescriptor 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

NewComponentConfigFromType 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)

ReadComponentConfigFromConfig 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

ContainerConfig Container configuration defined as a list of component configurations.

func NewContainerConfig

func NewContainerConfig(components ...*ComponentConfig) ContainerConfig

NewContainerConfig creates a new instance of container configuration.

Parameters: components *ComponentConfig a list of component configurations.
Returns: ContainerConfig

func NewContainerConfigFromValue

func NewContainerConfigFromValue(value any) ContainerConfig

NewContainerConfigFromValue 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 any 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)

ReadContainerConfigFromConfig 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

Jump to

Keyboard shortcuts

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