Documentation ¶
Index ¶
- Constants
- func Add(x, y int) int
- func ConcatURL(url, path string) string
- func ElapsedSec(lastTimestamp int64, elapsedTime int64) bool
- func FormattedDateUTC(t time.Time) string
- func FuzzyTimeStr(duration time.Duration) string
- func GetDistanceKm(lat1, lon1, lat2, lon2 float32) float32
- func Hostname() string
- func IsAdditionalCountry(clientInfo network.GeoIPRecord, list []string) bool
- func IsInSlice(a string, list []string) bool
- func IsPrimaryCountry(clientInfo network.GeoIPRecord, list []string) bool
- func IsStopped(stop <-chan struct{}) bool
- func Max(v1, v2 int) int
- func Min(v1, v2 int) int
- func NormalizeURL(url string) string
- func Plural(value interface{}) string
- func ReadableSize(value int64) string
- func SanitizeLocationCodes(input string) string
- func TimeKeyCoverage(start, end time.Time) (dates []string)
- func Version() string
Constants ¶
const ( // DegToRad is a constant to convert degrees to radians DegToRad = 0.017453292519943295769236907684886127134428718885417 // N[Pi/180, 50] // RadToDeg is a constant to convert radians to degrees RadToDeg = 57.295779513082320876798154814105170332405472466564 // N[180/Pi, 50] )
Variables ¶
This section is empty.
Functions ¶
func ElapsedSec ¶
ElapsedSec returns true if lastTimestamp + elapsed time is in the past
func FormattedDateUTC ¶
FormattedDateUTC returns the date formatted as RFC1123
func FuzzyTimeStr ¶
FuzzyTimeStr returns the duration as fuzzy time
func GetDistanceKm ¶
GetDistanceKm returns the distance in km between two coordinates
func IsAdditionalCountry ¶
func IsAdditionalCountry(clientInfo network.GeoIPRecord, list []string) bool
IsAdditionalCountry returns true if the clientInfo country is in list
func IsInSlice ¶
IsInSlice returns true is `a` is contained in `list` Warning: this is slow, don't use it for long datasets
func IsPrimaryCountry ¶
func IsPrimaryCountry(clientInfo network.GeoIPRecord, list []string) bool
IsPrimaryCountry returns true if the clientInfo country is the primary country
func IsStopped ¶
func IsStopped(stop <-chan struct{}) bool
IsStopped returns true if a stop has been requested
func NormalizeURL ¶
NormalizeURL adds a trailing slash to the URL
func Plural ¶
func Plural(value interface{}) string
Plural returns a single 's' if there are more than one value
func ReadableSize ¶
ReadableSize returns a file size in a human readable form
func SanitizeLocationCodes ¶
SanitizeLocationCodes sanitizes the given location codes
func TimeKeyCoverage ¶
TimeKeyCoverage returns a slice of strings covering the date range used in the redis backend.
Types ¶
This section is empty.