Documentation ¶
Index ¶
- Constants
- func Contains(haystack []string, needle string) bool
- func FormatThumbnailURL(baseURL string, r *http.Request, urlString string) string
- func IsDomain(url *url.URL, domain string) bool
- func IsDomains(url *url.URL, domains map[string]struct{}) bool
- func IsSubdomainOf(url *url.URL, parent string) bool
- func LookupEnv(envSuffix string) (value string, exists bool)
- func MarshalNoDur(i interface{}) ([]byte, time.Duration, error)
- func StringPtr(s string) *string
- func TruncateString(s string, maxLength int) string
- func UnescapeURLArgument(r *http.Request, key string) (string, error)
Constants ¶
const (
CHATTERINO_ENV_PREFIX = "CHATTERINO_API_"
)
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
Contains returns true if the given string array (haystack) contains given string (needle)
func FormatThumbnailURL ¶
func IsDomain ¶
IsDomain checks whether `url`s domain matches the given domain exactly (non-case sensitive) The `domain` string must be fully lowercased
func IsDomains ¶
IsDomains checks whether `url`s domain matches any of the given domains exactly (non-case sensitive) The `domains` map should only contain fully lowercased domains
func IsSubdomainOf ¶
IsSubdomainOf checks whether `url` is a subdomain of `parent`
func LookupEnv ¶ added in v1.0.1
LookupEnv is a thin wrapper of os.LookupEnv, except it prefixes the given envSuffix with the standard environment variable prefix (i.e. CHATTERINO_API_) Calling LookupEnv("YOUTUBE_API_KEY") would return the value for the environment variable CHATTERINO_API_YOUTUBE_API_KEY
func TruncateString ¶
TruncateString truncates string down to the maximum length with a unicode triple dot if truncation took place
Types ¶
This section is empty.