util

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2016 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BSONFAIL = "FAIL"
)

BSONFAIL is a bson.ObjectId failure indicator

View Source
const URL string = `` /* 322-byte string literal not displayed */

Variables

View Source
var BAD = -1
View Source
var GOOD = 0

Functions

func AvgMaxPos

func AvgMaxPos(vals []float64) (avg float64, max float64, maxPos float64)

AvgMaxPos calculating mean (average), maximum value, and position of max value in a data set

func Exists

func Exists(path string) (bool, error)

* Name: Exists * Purpose: Returns true if file or directory exists, false otherwise * comments:

func IsIP

func IsIP(ip string) bool

* Name: IsIP * Purpose: Returns true if string is a valid IP address, false otherwise * comments:

func IsLoopback

func IsLoopback(ip string) bool

* Name: IsLoopback * Purpose: Returns true if string is a valid IP address, false otherwise * comments:

func IsSpecialIP

func IsSpecialIP(ip string) bool

IsSpecialIP attempts to filter some IPs that we don't care about

func IsURL

func IsURL(str string) bool

* Name: IsURL * Purpose: Returns true if string is a URL, false otherwise * comments:

func Mean

func Mean(numList []float64) float64

Mean calculating the mean (average) of a data set

func RFC1918

func RFC1918(ip string) bool

RFC1918 returns true if it the ip looks non routable

func StdDev

func StdDev(numList []float64) float64

StdDev calculating the standard deviation (quantified amount of variation or dispersion) of a data set

func TypeConvert

func TypeConvert(m interface{}, desiredType reflect.Kind) (interface{}, int)

* Name: TypeConvert * Purpose: Dynamic type converter * comments:

func ValidIP

func ValidIP(ip string) bool

ValidIP validates an ip

func Variance

func Variance(numList []float64) float64

Variance calculating the variance of a data set

Types

type ByStringLength

type ByStringLength []string

ByStringLength Functions that, in combination with golang sort, allow users to sort a slice/list of strings by string length (shortest -> longest)

func (ByStringLength) Len

func (s ByStringLength) Len() int

func (ByStringLength) Less

func (s ByStringLength) Less(i, j int) bool

func (ByStringLength) Swap

func (s ByStringLength) Swap(i, j int)

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a simple cache mechanism to avoid db lookups

func NewCache

func NewCache() Cache

NewCache creates a new connection cache

func (Cache) Keys

func (c Cache) Keys() []string

func (Cache) Lookup

func (c Cache) Lookup(hash string) bool

Lookup a value in the cache, return true if present or false if not found. Once a lookup has been performed the value is cached so that the next lookup will cause the cache to return true.

type SortableInt64

type SortableInt64 []int64

SortableInt64 functions that allow a golang sort of int64s

func (SortableInt64) Len

func (s SortableInt64) Len() int

func (SortableInt64) Less

func (s SortableInt64) Less(i, j int) bool

func (SortableInt64) Swap

func (s SortableInt64) Swap(i, j int)

Jump to

Keyboard shortcuts

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