utils

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(haystack []string, needle string) bool

Contains returns true if the given string array (haystack) contains given string (needle)

func FormatThumbnailURL

func FormatThumbnailURL(baseURL string, r *http.Request, urlString string) string

func IsDomain

func IsDomain(url *url.URL, domain string) bool

IsDomain checks whether `url`s domain matches the given domain exactly (non-case sensitive) The `domain` string must be fully lowercased

func IsDomains

func IsDomains(url *url.URL, domains map[string]struct{}) bool

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

func IsSubdomainOf(url *url.URL, parent string) bool

IsSubdomainOf checks whether `url` is a subdomain of `parent`

func MarshalNoDur

func MarshalNoDur(i interface{}) ([]byte, time.Duration, error)

func StringPtr

func StringPtr(s string) *string

func TruncateString

func TruncateString(s string, maxLength int) string

TruncateString truncates string down to the maximum length with a unicode triple dot if truncation took place

func UnescapeURLArgument

func UnescapeURLArgument(r *http.Request, key string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL