utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyNamedFormat

func ApplyNamedFormat(format string, data map[string]string) string

ApplyNamedFormat apply format using a map data

func CalculateProbabilityLimit

func CalculateProbabilityLimit(slice interface{}) (limit float64)

CalculateProbabilityLimit calculates probability limit given a slice, panics when not a slice

func ParseStringEnvVar

func ParseStringEnvVar(name string, required bool, exampleValue string) string

ParseStringEnvVar parse an env var value as string

func RandomElement

func RandomElement(slice interface{}) interface{}

RandomElement gets a random element from a slice, panics when not a slice

func RandomWeighted

func RandomWeighted(slice interface{}, limit float64) (match interface{})

RandomWeighted get a randomly weighted value by using each element match probablity, panics when not a slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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