Documentation
¶
Index ¶
- func AppendStr(strs []string, str string) []string
- func GetJSON(url string, resp interface{}) error
- func IsSliceContainsStr(sl []string, str string) bool
- func Pluralize(count int, word string) string
- func PluralizeWord(count int, word string) string
- func PostJSON(url string, data, resp interface{}) error
- func PrettifyNumber(num int) string
- func PrettifySuffix(num int) string
- func RawPrettifySuffix(num, blockSize float64, suffixes []string) string
- func RenderTemplate(t *template.Template, tag string, vars interface{}) (string, error)
- func TemplateMustCompile(name, data string) *template.Template
- type Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSliceContainsStr ¶
IsSliceContainsStr returns true if the string exists in given slice, ignore case.
func Pluralize ¶
Pluralize attempts to pluralize the given word (and display the number) if count > 1
func PluralizeWord ¶
PluralizeWord attempts to pluralize the given word if count > 1
func PrettifyNumber ¶
PrettifyNumber displays a number with commas
func PrettifySuffix ¶
PrettifySuffix displays a semi-human-readable format such as 4k in place of 4125.
func RawPrettifySuffix ¶
RawPrettifySuffix displays a semi-human-readable format such as 4k in place of 4125 with a number of weird options.
func RenderTemplate ¶
RenderTemplate is a wrapper to render a template to a string.
func TemplateMustCompile ¶
TemplateMustCompile will add all the helpers to a new template, compile it and panic if that fails. Note that it will also trim space from the start and end of the template to make definitions easier.
Provided functions: - dateFormat - takes one argument, the format of the date (in golang format) - pluralize - takes one argument, the number of something this is describing