Documentation ¶
Index ¶
- Variables
- func BaseName(str string) string
- func CleanString(str string, r *regexp.Regexp) string
- func Color(colorString string) func(...interface{}) string
- func DecodeBase64(encode string) string
- func DelInitialSlash(path string) string
- func EncodeBase64(value string) string
- func EndsWithSlash(path string) string
- func FileExists(fileName string) bool
- func FileNameISO8601(fileName string) string
- func FilenameWithoutExtension(fileName string) string
- func GetEnvVariable(name, defVal string) string
- func IsValidUUID(id string) bool
- func LoadDataFromJSON(body interface{}, fileName string) error
- func LoadDataFromYAML(body interface{}, fileName string) error
- func Name(str string) string
- func ReadFile(fileName string) []byte
- func SetEnvVariable(name, value string) string
- func ValidFileName(folderName, fileName string) string
- func WriteDataToJSON(body interface{}, fileName string) error
- func WriteDataToYAML(body interface{}, fileName string) error
- func WriteFile(body io.Reader, fileName string) error
Constants ¶
This section is empty.
Variables ¶
var ( Info = Teal Warn = Yellow Fatal = Red Success = Green )
var ( White = Color("\033[0;30m%s\033[0m") Red = Color("\033[0;31m%s\033[0m") Green = Color("\033[0;32m%s\033[0m") Yellow = Color("\033[0;33m%s\033[0m") Purple = Color("\033[0;34m%s\033[0m") Magenta = Color("\033[0;35m%s\033[0m") Teal = Color("\033[0;36m%s\033[0m") LightWhite = Color("\033[1;30m%s\033[0m") LightRed = Color("\033[1;31m%s\033[0m") LightGreen = Color("\033[1;32m%s\033[0m") LightYellow = Color("\033[1;33m%s\033[0m") LightBlue = Color("\033[1;34m%s\033[0m") LightMagenta = Color("\033[1;35m%s\033[0m") LightTeal = Color("\033[1;36m%s\033[0m") Normal = Color("\033[1;37m%s\033[0m") )
Functions ¶
func BaseName ¶
BaseName makes a string safe to use in a file name, producing a sanitized basename replacing . or / with -. No attempt is made to normalise a path or normalise case.
func CleanString ¶
CleanString replaces separators with - and removes characters listed in the regexp provided from string. Accents, spaces, and all characters not in A-Za-z0-9 are replaced.
func DecodeBase64 ¶ added in v1.0.3
DecodeBase64 returns plain text from base64 entry
func DelInitialSlash ¶
DelInitialSlash just delete (if exists) a initial /
func EncodeBase64 ¶ added in v1.0.3
EncodeBase64 returns base64 encoded text
func EndsWithSlash ¶
EndsWithSlash just check if a path ends with /, if not add
func FileExists ¶ added in v1.0.7
func FileNameISO8601 ¶
FileNameISO8601 returns a valid fileName with ISO8606 timestamp on it
func FilenameWithoutExtension ¶ added in v1.0.2
FilenameWithoutExtension returns a valid fileName without extension
func GetEnvVariable ¶ added in v1.0.3
GetEnvVariable try to get an environment variable, returns default value otherwise
func IsValidUUID ¶ added in v1.0.6
IsValidUUID just validate if an uuid is valid (Version 1 or Version 4)
func LoadDataFromJSON ¶ added in v1.0.1
LoadDataFromJSON reads a JSON format file and returns its contents on body
func LoadDataFromYAML ¶ added in v1.0.1
LoadDataFromYAML reads a YAML format file and returns its contents on body
func Name ¶
Name makes a string safe to use in a file name by first finding the path basename, then replacing non-ascii characters.
func SetEnvVariable ¶ added in v1.0.3
SetEnvVariable try to set an environment variable, returns current value if exist, empty string otherwise
func ValidFileName ¶
ValidFileName returns a valid fileName without not-ascii characters
func WriteDataToJSON ¶ added in v1.0.1
WriteDataToJSON saves the content of body in a JSON format file
func WriteDataToYAML ¶ added in v1.0.1
WriteDataToYAML saves the content of body in a YAML format file
Types ¶
This section is empty.