Documentation ¶
Index ¶
- Constants
- func BcryptHash(text string, costs int) string
- func DecodeBase64(enc *base64.Encoding, text string) string
- func DecodeURI(decodedURI string) (string, error)
- func EncodeBase64(enc *base64.Encoding, text string) string
- func EncodeURI(uri string) string
- func Hash(hash hash.Hash, text string) string
- func Open(url string)
- func ParseTimestamp(date string) (time.Time, error)
- func Random(n int, a Source) string
- func RandomNumber(n int) string
- type AlphaNumeric
- type Alphabet
- type Complex
- type Numeric
- type Semaphore
- type Source
Constants ¶
const ALPH = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
ALPH are alphabet letters in lower and upper case
const NUM = "0123456789"
NUM are numbers [0:10)
const SPECIAL = "!#$%&()*+,-./:;><?^_"
SPECIAL are special characters
Variables ¶
This section is empty.
Functions ¶
func BcryptHash ¶ added in v0.2.0
BcryptHash returns a string representation of a hashed text with given cost
func DecodeBase64 ¶
DecodeBase64 decodes a base64 string to it's plain text representation
func DecodeURI ¶ added in v1.0.1
DecodeURI does the inverse transformation of EncodeUri. Currently it's just a delegate for uri.QueryUnescape.
func EncodeBase64 ¶
EncodeBase64 encodes a plain string to it's base64 representation
func Open ¶ added in v1.0.1
func Open(url string)
Open opens the default system browser and points to the given url.
func ParseTimestamp ¶
ParseTimestamp tries to parses a string into a time.Time format. The following cascade is used: 1. It tries to parse the string as current time millis. 2. It tries to parse the string as current time nanos. 3. It tries to parse the string as RFC 3339 time.
func Random ¶ added in v0.0.2
Random generates a random string with a length of n. Each letter of the random string has it's source in the given source a
func RandomNumber ¶ added in v0.0.2
RandomNumber generates a random number with a length of n. Each letter of the random string has it's source in the Numeric source, but the first number of the string is in a range of [1,10)
Types ¶
type AlphaNumeric ¶ added in v0.0.2
type AlphaNumeric struct{}
AlphaNumeric is a source of letters and numbers: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
type Alphabet ¶ added in v0.0.2
type Alphabet struct{}
Alphabet is a source of letters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
type Complex ¶ added in v0.0.2
type Complex struct{}
Complex is the same as the AlphaNumeric source but adds also special characters
type Numeric ¶ added in v0.0.2
type Numeric struct{}
Numeric is a default source of numbers in a range of [0,10).