Documentation ¶
Index ¶
- Variables
- type Configuration
- func (a *Configuration) AddProperty(name, description string, requierd bool)
- func (a *Configuration) GetProperty(name string) *Property
- func (a *Configuration) RemoveProperty(name string)
- func (a *Configuration) SetProperty(name string, value interface{}) error
- func (a *Configuration) ValidateProperties() (bool, []string)
- type Property
- func (p *Property) Bool() (bool, error)
- func (p *Property) Int() (int, error)
- func (p *Property) Int64() (int64, error)
- func (p *Property) IsValid() bool
- func (p *Property) MapWithSlice() (map[string][]string, error)
- func (p *Property) String() string
- func (p *Property) StringMap() (map[string]string, error)
- func (p *Property) StringSplice() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
var ( //ErrWrongPropertyType is cast when the Property is of another type ErrWrongPropertyType = errors.New("the property is not of this data type") //ErrNoSuchProperty is when trying to assign value to Property that does not exist ErrNoSuchProperty = errors.New("the property ur trying to set the value for does not exist") )
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { Properties []*Property `json:"properties" yaml:"properties"` sync.Mutex `json:"-" yaml:"-"` }
Configuration is used to store Cfg for Actions and metadata for Payloads
func NewConfiguration ¶
func NewConfiguration() *Configuration
NewConfiguration will initialize a configuration properly to avoid nil pointers
func (*Configuration) AddProperty ¶
func (a *Configuration) AddProperty(name, description string, requierd bool)
AddProperty is used to add an Property to the PropertyContainer
func (*Configuration) GetProperty ¶
func (a *Configuration) GetProperty(name string) *Property
GetProperty is used to extract an property from the Configuration
func (*Configuration) RemoveProperty ¶
func (a *Configuration) RemoveProperty(name string)
RemoveProperty will remove any added properties
func (*Configuration) SetProperty ¶
func (a *Configuration) SetProperty(name string, value interface{}) error
SetProperty will extract properties from the map,
func (*Configuration) ValidateProperties ¶
func (a *Configuration) ValidateProperties() (bool, []string)
ValidateProperties will make sure that all properties are actually there that is required
type Property ¶
type Property struct { Name string `json:"name" yaml:"name"` Value interface{} `json:"value" yaml:"value"` Description string `json:"description" yaml:"description"` Required bool `json:"required" yaml:"required"` Valid bool `json:"valid" yaml:"valid"` }
Property is a value holder used by Actions to handle Configs
func (*Property) IsValid ¶
IsValid is used to control if Required is true, then Value cannot be nil, if it is it will return False
func (*Property) MapWithSlice ¶
MapWithSlice will return a Map that holds a slice of strings
func (*Property) StringSplice ¶
StringSplice is used to get the value as a stringslice