util

package
v1.0.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: GPL-3.0 Imports: 9 Imported by: 3 modules, 9 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

View Source
const (
	BSONFAIL = "FAIL"
)

BSONFAIL is a bson.ObjectId failure indicator

View Source
const TimeFormat string = "2006-01-02-T15:04:05-0700"
View Source
const URL string = `` /* 322-byte string literal not displayed */

Variables

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

Functions

func Abs added in v1.0.0

func Abs(a int64) int64

two's complement 64 bit abs value

func AvgMaxPos

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

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

func Exists

func Exists(path string) (bool, error)

UNUSED

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

func IsIP

func IsIP(ip string) bool

UNUSED

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

func IsLoopback

func IsLoopback(ip string) bool

UNUSED

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

func IsSpecialIP

func IsSpecialIP(ip string) bool

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

func IsURL

func IsURL(str string) bool

UNUSED

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

func Max added in v1.0.0

func Max(a int, b int) int

func Mean

func Mean(numList []float64) float64

UNUSED Mean calculating the mean (average) of a data set

func Min added in v1.0.0

func Min(a int, b int) int

retun the smaller of two integers

func RFC1918

func RFC1918(ip string) bool

RFC1918 returns true if it the ip looks non routable

func RemoveSortedDuplicates added in v1.0.0

func RemoveSortedDuplicates(sortedIn []int64) []int64

given a sorted slice, remove the duplicates

func Round added in v1.0.0

func Round(f float64) int64

rounding function since go doesn't have it

func StdDev

func StdDev(numList []float64) float64

UNUSED 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)

UNUSED

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

func ValidIP

func ValidIP(ip string) bool

UNUSED ValidIP validates an ip

func Variance

func Variance(numList []float64) float64

UNUSED 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

UNUSED

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