Documentation
¶
Overview ¶
Helpful utility functions.
Index ¶
- func CleanString(str string, unescape bool) string
- func DirExists(path string) (bool, error)
- func Format(tpl *template.Template, params map[string]string) string
- func HashPassword(password string) string
- func MapToSlice(boolMap map[string]bool) []string
- func MustForceLocalTimezone(date time.Time) time.Time
- func RemoveDuplicates(slice []string) []string
- func RemoveFromSlice(slice []string, item string) []string
- func SliceToMap(slice []string) map[string]bool
- func StandardizeURL(url string) string
- func StripTags(text string) string
- func ToStringSlice(elements []interface{}) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanString ¶
CleanString cleans a string from new lines and caret returns, un-escapes HTML entities and trims spaces.
func MapToSlice ¶
MapToSlice will save keys of a string map into a slice.
func MustForceLocalTimezone ¶
MustForceLocalTimezone adds current timezone to passed date, without recalculating the date.
func RemoveDuplicates ¶
RemoveDuplicates will remove duplicates from a slice of strings.
func RemoveFromSlice ¶
RemoveFromSlice will remove an element from string slice by value, assuming the element is there only once.
func SliceToMap ¶
SliceToMap will convert a string slice into a string map.
func StandardizeURL ¶
StandardizeURL standardizes the url by making sure it has a schema and converting IDNA domains into ASCII.
func ToStringSlice ¶
func ToStringSlice(elements []interface{}) []string
ToStringSlice converts arbitrary interface slice into a string slice.
Types ¶
This section is empty.