Documentation ¶
Index ¶
- Variables
- func BoolEnv(key string) bool
- func CalculateTimeRange(daysAgo int) (string, string)
- func EnvOrDefault(key string, fallback string) string
- func IntEnv(key string) int
- func IsAlphaNumeric(str string) bool
- func IsSensitiveEnv(str string) bool
- func QueryParamOrDefault(r *http.Request, param, fallback string) string
- func RandomString(n int) string
- func RequireEnv(key string)
- func ShortID() string
- func UIntEnv(key string) uint
- func UTCDateString() string
- func UnixToDate(u int64) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // OneYear is the unix time for 1 year OneYear = time.Now().Add(time.Minute * 525600).Unix() OneMinMs = "60000" TwoMinMs = "120000" FiveMinMs = "300000" TenMinMs = "600000" )
Functions ¶
func CalculateTimeRange ¶
CalculateTimeRange returns the start & end date from a number of days ago
func EnvOrDefault ¶
EnvOrDefault returns and environment variable or a default value
func IsAlphaNumeric ¶
func IsSensitiveEnv ¶
IsSensitive returns true if an environment variable name suggests that the value "may" contain sensitive information
func QueryParamOrDefault ¶
QueryParamOrDefault get a query parameter from an http request. Returns a default value if query param not set
func RandomString ¶
RandomString creates a random alpha-numeric string of size n
func RequireEnv ¶
func RequireEnv(key string)
RequireEnv exits the program if environment vairables not set
func UTCDateString ¶
func UTCDateString() string
UTCDateString returns the current date time in RFC3339 format
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.