Documentation ¶
Index ¶
- Variables
- func AllKeys() []string
- func AllSettings() map[string]interface{}
- func ConfigFileUsed() string
- func FormatID(base string, formatted string) string
- func Get(key string) interface{}
- func GetPackageTypeName(s string) string
- func GoNormalize(s string) string
- func IsSet(key string) bool
- func LowerGoNormalize(s string) string
- func ReplaceDict(src string, dict map[string]interface{}) string
- func Set(key string, o interface{}) string
- func SupportedExts() []string
- func SupportedRemoteProviders() []string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultFMap = template.FuncMap{ "string": func(i interface { String() string }) string { return i.String() }, "json": func(v interface{}) string { a, err := json.Marshal(v) if err != nil { return err.Error() } return string(a) }, "prettyjson": func(v interface{}) string { a, err := json.MarshalIndent(v, "", " ") if err != nil { return err.Error() } return string(a) }, "splitArray": func(sep string, s string) []interface{} { var r []interface{} t := strings.Split(s, sep) for i := range t { if t[i] != "" { r = append(r, t[i]) } } return r }, "first": func(a []string) string { return a[0] }, "last": func(a []string) string { return a[len(a)-1] }, "concat": func(a string, b ...string) string { return strings.Join(append([]string{a}, b...), "") }, "join": func(sep string, a ...string) string { return strings.Join(a, sep) }, "upperFirst": func(s string) string { return strings.ToUpper(s[:1]) + s[1:] }, "lowerFirst": func(s string) string { return strings.ToLower(s[:1]) + s[1:] }, "camelCase": func(s string) string { if len(s) > 1 { return xstrings.ToCamelCase(s) } return strings.ToUpper(s[:1]) }, "lowerCamelCase": func(s string) string { if len(s) > 1 { s = xstrings.ToCamelCase(s) } return strings.ToLower(s[:1]) + s[1:] }, "kebabCase": func(s string) string { return strings.Replace(xstrings.ToSnakeCase(s), "_", "-", -1) }, "contains": func(sub, s string) bool { return strings.Contains(s, sub) }, "trimstr": func(cutset, s string) string { return strings.Trim(s, cutset) }, "index": func(array interface{}, i int32) interface{} { slice := reflect.ValueOf(array) if slice.Kind() != reflect.Slice { panic("Error in index(): given a non-slice type") } if i < 0 || int(i) >= slice.Len() { panic("Error in index(): index out of bounds") } return slice.Index(int(i)).Interface() }, "add": func(a int, b int) int { return a + b }, "subtract": func(a int, b int) int { return a - b }, "multiply": func(a int, b int) int { return a * b }, "divide": func(a int, b int) int { if b == 0 { panic("psssst ... little help here ... you cannot divide by 0") } return a / b }, "snakeCase": xstrings.ToSnakeCase, "set": Set, "get": Get, "allSettings": AllSettings, "allKeys": AllKeys, "configFileUsed": ConfigFileUsed, "supportedExts": SupportedExts, "isSet": IsSet, "supportedRemoteProviders": SupportedRemoteProviders, } )
Functions ¶
func AllSettings ¶
func AllSettings() map[string]interface{}
func ConfigFileUsed ¶
func ConfigFileUsed() string
func GetPackageTypeName ¶
func GoNormalize ¶
func LowerGoNormalize ¶
func ReplaceDict ¶
func SupportedExts ¶
func SupportedExts() []string
func SupportedRemoteProviders ¶
func SupportedRemoteProviders() []string
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.