Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(input, output interface{}) (err error)
Decode decodes the given data into the given result. In case of the target Type if a Valuable, we serialize it with `SerializeValuable` func. @param input is the data to decode @param output is the result of the decoding @return an error if the decoding failed
Types ¶
type Valuable ¶
type Valuable struct { // Value represents the `value` field of a configuration entry that // contains only one value Value *string `json:"value,omitempty"` // Values represents the `value` field of a configuration entry that // contains multiple values stored in a list Values []string `json:"values,omitempty"` // ValueFrom represents the `valueFrom` field of a configuration entry // that contains a reference to a data source ValueFrom *ValueFromSource `json:"valueFrom,omitempty"` }
Valuable represent value who it is possible to retrieve the data in multiple ways. From a simple value without nesting, or from a deep data source.
func SerializeValuable ¶
SerializeValuable serialize anything to a Valuable @param data is the data to serialize @return the serialized Valuable
func (*Valuable) Contains ¶
Contains returns true if the Valuable contains the given value @param value is the value to check @return true if the Valuable contains the given value
func (*Valuable) First ¶
First returns the first value of the Valuable possible values as a string. The order of preference is: - Values - Value - ValueFrom.StaticRef - ValueFrom.EnvRef @return the first value
type ValueFromSource ¶
type ValueFromSource struct { // StaticRef represents the `staticRef` field of a configuration entry // that contains a static value. Can contain a comma separated list StaticRef *string `json:"staticRef,omitempty"` // EnvRef represents the `envRef` field of a configuration entry // that contains a reference to an environment variable EnvRef *string `json:"envRef,omitempty"` }
ValueFromSource represents the `valueFrom` field of a configuration entry that contains a reference to a data source (file, env, etc.)