Documentation
¶
Index ¶
- Constants
- func ParamConstructorWrapper[objectInstance any](objectConstructor func(any) (objectInstance, error)) func(any) (any, error)
- func StringSliceValueObjectParser[TypedObject any](rawInputValues any, valueObjectConstructor func(any) (TypedObject, error)) []TypedObject
- type RequestInputParsed
- type RequestInputSettings
Constants ¶
View Source
const ( // spf13/cobra (cli lib) does not support nil or pointers as default values. // UnsetParameterValueStr is a special value to circumvent this limitation. UnsetParameterValueStr string = "__UNSET__" )
Variables ¶
This section is empty.
Functions ¶
func ParamConstructorWrapper ¶ added in v0.0.3
func ParamConstructorWrapper[objectInstance any]( objectConstructor func(any) (objectInstance, error), ) func(any) (any, error)
Go requires exact function signature matches, unless using generics to infer type. Hence, this wrapper must be used when creating the KnownParamConstructors map.
func StringSliceValueObjectParser ¶
func StringSliceValueObjectParser[TypedObject any]( rawInputValues any, valueObjectConstructor func(any) (TypedObject, error), ) []TypedObject
StringSliceValueObjectParser converts various input formats into a slice of typed objects. It accepts: - nil (returns empty slice) - string (splits by ";" or "," and parses each element) - slice (parses each element) - single value (parses as one element)
The valueObjectConstructor function is used to convert each raw value into the desired type. Invalid values are logged and skipped.
Types ¶
type RequestInputParsed ¶ added in v0.0.3
type RequestInputParsed struct {
KnownParams map[string]any
KnownParamErrors map[string]error
ClearableParams map[string]any
UnknownParams map[string]any
}
func RequestInputParser ¶ added in v0.0.3
func RequestInputParser( componentSettings RequestInputSettings, ) (requestInputParsed RequestInputParsed)
Click to show internal directories.
Click to hide internal directories.