Documentation ¶
Index ¶
- Variables
- func CancelOnSignal(ctx context.Context, signal_ os.Signal, cancel func()) error
- func CastList[To any, From any](list []From) ([]To, bool)
- func CastList2[To any, From any](list interface{}) ([]To, bool)
- func CastMapMember[To any](m map[string]interface{}, k string) (*To, bool)
- func CastStringMap[To any, From any](m map[string]From) (map[string]To, bool)
- func CastToNumberList[To Number, From Number](list []From) ([]To, bool)
- func ConvertJSONArrayToYAML(jsonContent string) (string, error)
- func ConvertJSONMapToYAML(jsonContent string) (string, error)
- func ConvertYAMLArrayToJSON(yamlContent string) (string, error)
- func ConvertYAMLMapToJSON(yamlContent string) (string, error)
- func CreateHtmlTemplate(name string) *html.Template
- func CreateTemplate(name string) *template.Template
- func InterfaceListToStringList(list []interface{}) []string
- func InterfaceToStringList(list interface{}) []string
- func LoadJSONFile(path string, target interface{}) error
- func LoadYAMLFile(path string, target interface{}) error
- func RenderHtmlTemplateString(tmpl string, data interface{}) (string, error)
- func RenderTemplate(tmpl TemplateExecute, data interface{}) (string, error)
- func RenderTemplateFile(filename string, data interface{}) (string, error)
- func RenderTemplateString(tmpl string, data interface{}) (string, error)
- func SetFloatListReflectValue[To Number](value reflect.Value, v interface{}) error
- func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
- func SetReflectValue(value reflect.Value, v interface{}) error
- func StringInSlice(needle string, haystack []string) bool
- func StructToMap(i interface{}, lowerCaseKeys bool) map[string]interface{}
- type FloatNumber
- type Number
- type SignedInt
- type TemplateExecute
- type UnsignedInt
Constants ¶
This section is empty.
Variables ¶
View Source
var TemplateFuncs = template.FuncMap{ "trim": strings.TrimSpace, "trimRightSpace": trimRightSpace, "trimTrailingWhitespaces": trimRightSpace, "rpad": rpad, "quote": quote, "stripNewlines": stripNewlines, "quoteNewlines": quoteNewlines, "toUpper": strings.ToUpper, "toLower": strings.ToLower, "replace": replace, "replaceRegexp": replaceRegexp, "add": add, "sub": sub, "div": div, "mul": mul, "parseFloat": parseFloat, "parseInt": parseInt, "currency": currency, "padLeft": padLeft, "padRight": padRight, "bold": bold, "underline": underline, "italic": italic, "strikethrough": strikethrough, "code": code, "codeBlock": codeBlock, "toYaml": toYaml, "indentBlock": indentBlock, }
TemplateFuncs provides helpers for the standard cobra usage and help templates
Functions ¶
func CancelOnSignal ¶
func CastList ¶ added in v0.2.6
CastList casts a list of From objects to To, by casting it to an interface{} in between.
func CastList2 ¶ added in v0.2.6
CastList2 attempts even harder to cast a list of From object to To, by checking if we might be dealing with a list masquerading as a interface{}, then a []interface{}, before checking for []To.
func CastMapMember ¶ added in v0.2.6
func CastStringMap ¶ added in v0.2.6
func CastToNumberList ¶ added in v0.2.6
CastToNumberList casts a list of From objects to To. This is useful for transform between different int types, for example.
func ConvertJSONArrayToYAML ¶ added in v0.2.5
func ConvertJSONMapToYAML ¶ added in v0.2.5
func ConvertYAMLArrayToJSON ¶ added in v0.2.5
func ConvertYAMLMapToJSON ¶ added in v0.2.5
func CreateHtmlTemplate ¶ added in v0.2.7
func CreateTemplate ¶ added in v0.2.5
func InterfaceListToStringList ¶
func InterfaceListToStringList(list []interface{}) []string
func InterfaceToStringList ¶
func InterfaceToStringList(list interface{}) []string
func LoadJSONFile ¶
func LoadYAMLFile ¶
func RenderHtmlTemplateString ¶ added in v0.2.7
func RenderTemplate ¶ added in v0.2.5
func RenderTemplate(tmpl TemplateExecute, data interface{}) (string, error)
func RenderTemplateFile ¶ added in v0.2.5
func RenderTemplateString ¶
func SetFloatListReflectValue ¶ added in v0.2.6
func SetIntListReflectValue ¶ added in v0.2.6
func SetReflectValue ¶ added in v0.2.6
func StringInSlice ¶
func StructToMap ¶
Types ¶
type FloatNumber ¶ added in v0.2.6
type TemplateExecute ¶ added in v0.2.7
Click to show internal directories.
Click to hide internal directories.