# README
utilities
utilities is a Go Library to share useful code, just that
Getting started
- API documentation is available via godoc.
Installation
To install utilities package, you need to install Go and set your Go workspace first.
1 - The first need Go installed (version 1.13+ is required). Then you can use the below Go command to install Requist
$ go get -u github.com/dotWicho/utilities
And then Import it in your code:
package main
import "github.com/dotWicho/utilities"
Or
2 - Use as module in you project (go.mod file):
module myproject
go 1.13
require (
github.com/dotWicho/utilities v1.0.6
)
# Functions
BaseName makes a string safe to use in a file name, producing a sanitized basename replacing .
CleanString replaces separators with - and removes characters listed in the regexp provided from string.
No description provided by the author
DecodeBase64 returns plain text from base64 entry.
DelInitialSlash just delete (if exists) a initial /.
EncodeBase64 returns base64 encoded text.
EndsWithSlash just check if a path ends with /, if not add.
No description provided by the author
FileNameISO8601 returns a valid fileName with ISO8606 timestamp on it.
FilenameWithoutExtension returns a valid fileName without extension.
GetEnvVariable try to get an environment variable, returns default value otherwise.
IsValidUUID just validate if an uuid is valid (Version 1 or Version 4).
LoadDataFromJSON reads a JSON format file and returns its contents on body.
LoadDataFromYAML reads a YAML format file and returns its contents on body.
Name makes a string safe to use in a file name by first finding the path basename, then replacing non-ascii characters.
ReadFile reads a file and returns its content if exists, on the other hand nil.
SetEnvVariable try to set an environment variable, returns current value if exist, empty string otherwise.
ValidFileName returns a valid fileName without not-ascii characters.
WriteDataToJSON saves the content of body in a JSON format file.
WriteDataToYAML saves the content of body in a YAML format file.
WriteFile writes io.ReadCloser to a file and returns an error if exists.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author