Documentation
¶
Index ¶
- func ContainsString(slice []string, s string) bool
- func GenerateRandomBase64String(n int) (string, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomHexString(n int) (string, error)
- func GenerateRandomString(n int, ranges []CharRange, extra string) (string, error)
- func GetEnv(key string, defaultVal string) string
- func GetEnvAsBool(key string, defaultVal bool) bool
- func GetEnvAsInt(key string, defaultVal int) int
- func GetEnvAsStringArr(key string, defaultVal []string, separator ...string) []string
- func GetEnvAsStringArrTrimmed(key string, defaultVal []string, separator ...string) []string
- func GetEnvEnum(key string, defaultVal string, allowedValues []string) string
- func GetProjectRootDir() string
- type CharRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsString ¶
ContainsString checks whether the given string slice contains the string provided.
func GenerateRandomBase64String ¶
GenerateRandomBase64String returns a string with n random bytes securely generated using the system's default CSPRNG in base64 encoding. The resulting string might not be of length n as the encoding for the raw bytes generated may vary.
An error will be returned if reading from the secure random number generator fails, at which point the returned result should be discarded and not used any further.
func GenerateRandomBytes ¶
GenerateRandomBytes returns n random bytes securely generated using the system's default CSPRNG.
An error will be returned if reading from the secure random number generator fails, at which point the returned result should be discarded and not used any further.
func GenerateRandomHexString ¶
GenerateRandomHexString returns a string with n random bytes securely generated using the system's default CSPRNG in hexadecimal encoding. The resulting string might not be of length n as the encoding for the raw bytes generated may vary.
An error will be returned if reading from the secure random number generator fails, at which point the returned result should be discarded and not used any further.
func GenerateRandomString ¶
GenerateRandomString returns a string with n random bytes securely generated using the system's default CSPRNG. The characters within the generated string will either be part of one ore more supplied range of characters, or based on characters in the extra string supplied.
An error will be returned if reading from the secure random number generator fails, at which point the returned result should be discarded and not used any further.
func GetEnvAsBool ¶
func GetEnvAsInt ¶
func GetEnvAsStringArr ¶
GetEnvAsStringArr reads ENV and returns the values split by separator.
func GetEnvAsStringArrTrimmed ¶
GetEnvAsStringArrTrimmed reads ENV and returns the whitespace trimmed values split by separator.
func GetProjectRootDir ¶
func GetProjectRootDir() string
GetProjectRootDir returns the path as string to the project_root for a **running application**. Note: This function should not be used for generation targets (go generate, make go-generate). Thus it's explicitly excluded from the build tag scripts, see instead: * /scripts/get_project_root_dir.go * ./get_project_root_dir_scripts.go (delegates to above) https://stackoverflow.com/questions/43215655/building-multiple-binaries-using-different-packages-and-build-tags