util

package
v0.13.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PredictableRandom = mathRand.New(mathRand.NewSource(42))

PredictableRandom is an RNG that will always have the same sequence. It will be seeded with the device ID during startup, so that the sequence is predictable but varies between instances.

Functions

func Address

func Address(network, host string) string

Address constructs a URL from the given network and hostname.

func FillNilSlices

func FillNilSlices(data interface{}) error

FillNilSlices sets default value on slices that are still nil.

func RandomInt64

func RandomInt64() int64

RandomInt64 returns a strongly random int64, slowly

func RandomString

func RandomString(l int) string

RandomString returns a string of random characters (taken from randomCharset) of the specified length.

func SeedFromBytes

func SeedFromBytes(bs []byte) int64

SeedFromBytes calculates a weak 64 bit hash from the given byte slice, suitable for use a predictable random seed.

func SetDefaults

func SetDefaults(data interface{}) error

SetDefaults sets default values on a struct, based on the default annotation.

func UniqueStrings

func UniqueStrings(ss []string) []string

UniqueStrings returns a list on unique strings, trimming and sorting them at the same time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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