Documentation
¶
Index ¶
- func ComputeFullPath(url string, r *http.Request) string
- func EnvOrDefault(name, def string) string
- func EnvOrDefaultBool(name string, def bool) bool
- func EnvOrDefaultInt32(name string, def int32) int32
- func EnvOrDefaultInt64(name string, def int64) int64
- func EnvOrDefaultStringSlice(name, separator string, def []string) []string
- func GetHttpRequestBaseUrl(r *http.Request) string
- func GetHttpRequestScheme(r *http.Request) string
- type HttpError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeFullPath ¶ added in v0.3.3
ComputeFullPath will add the current canonical hostname to a URL, if it doesn't already contain the canonical hostname (i.e. it is only a path)
func EnvOrDefault ¶ added in v0.2.0
EnvOrDefault returns the value of the environment variable identified by name parameter, or the value of the def parameter if the environment variable is missing.
Note: It will return an empty string if the environment variable is set to an empty string.
func EnvOrDefaultBool ¶ added in v0.2.1
EnvOrDefaultBool returns the value of the environment variable identified by name parameter cast to a boolean, or the value of the def parameter if the environment variable is missing or empty.
Note: It will return the value of def if the environment variable is set to an empty string.
func EnvOrDefaultInt32 ¶ added in v0.2.1
EnvOrDefaultInt32 returns the value of the environment variable identified by name parameter cast to a 32bit decimal integer, or the value of the def parameter if the environment variable is missing or empty.
Note: It will return the value of def if the environment variable is set to an empty string.
func EnvOrDefaultInt64 ¶ added in v0.2.1
EnvOrDefaultInt64 returns the value of the environment variable identified by name parameter cast to a 64bit decimal integer, or the value of the def parameter if the environment variable is missing or empty.
Note: It will return the value of def if the environment variable is set to an empty string.
func EnvOrDefaultStringSlice ¶ added in v0.3.0
EnvOrDefaultStringSlice returns the value of the environment variable identified by name parameter split by the value of the separator parameter as a slice of strings, or the value of the def parameter if the environment variable is missing.
Note: It will return an empty slice if the environment variable is set to an empty string.
func GetHttpRequestBaseUrl ¶ added in v0.3.3
GetHttpRequestBaseUrl returns a canonical hostname for the current request in the form of <scheme>://<host or ip>:<port>
func GetHttpRequestScheme ¶ added in v0.3.3
GetHttpRequestScheme determines the protocol scheme used in the request call. Returns either "http" or "https", always lowercase
Types ¶
type HttpError ¶
HttpError defines the generic structure of an HTTP error response.
func (*HttpError) Error ¶
Error will return the string representation of the HttpError.Message and Err, omitting the former if it is not set.
func (*HttpError) ErrorAndStack ¶
ErrorAndStack will return both the output of Error and StackTrace in one call
func (*HttpError) StackTrace ¶
StackTrace will return a string representation of Err's stack trace