helper

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToPtr

func BoolToPtr(b bool) *bool

boolToPtr returns the pointer to a boolean

func CheckHCLKeys added in v0.7.0

func CheckHCLKeys(node ast.Node, valid []string) error

func CleanEnvVar added in v0.5.5

func CleanEnvVar(s string, r byte) string

CleanEnvVar replaces all occurrences of illegal characters in an environment variable with the specified byte.

func CompareMapStringString added in v0.9.0

func CompareMapStringString(a, b map[string]string) bool

CompareMapStringString returns true if the maps are equivalent. A nil and empty map are considered not equal.

func CompareSliceSetString added in v0.9.5

func CompareSliceSetString(a, b []string) bool

CompareSliceSetString returns true if the slices contain the same strings. Order is ignored. The slice may be copied but is never altered. The slice is assumed to be a set. Multiple instances of an entry are treated the same as a single instance.

func CopyMapStringFloat64

func CopyMapStringFloat64(m map[string]float64) map[string]float64

func CopyMapStringInt

func CopyMapStringInt(m map[string]int) map[string]int

func CopyMapStringSliceString added in v0.6.1

func CopyMapStringSliceString(m map[string][]string) map[string][]string

CopyMapStringSliceString copies a map of strings to string slices such as http.Header

func CopyMapStringString

func CopyMapStringString(m map[string]string) map[string]string

Helpers for copying generic structures.

func CopyMapStringStruct added in v0.6.1

func CopyMapStringStruct(m map[string]struct{}) map[string]struct{}

func CopySliceInt

func CopySliceInt(s []int) []int

func CopySliceString

func CopySliceString(s []string) []string

func Float64ToPtr added in v0.9.0

func Float64ToPtr(f float64) *float64

Float64ToPtr returns the pointer to an float64

func HashUUID added in v0.6.0

func HashUUID(input string) (output string, hashed bool)

HashUUID takes an input UUID and returns a hashed version of the UUID to ensure it is well distributed.

func Int64ToPtr added in v0.6.0

func Int64ToPtr(i int64) *int64

Int64ToPtr returns the pointer to an int

func Int8ToPtr added in v0.9.0

func Int8ToPtr(i int8) *int8

Int8ToPtr returns the pointer to an int8

func IntMax added in v0.6.1

func IntMax(a, b int) int

func IntMin added in v0.6.0

func IntMin(a, b int) int

func IntToPtr added in v0.5.5

func IntToPtr(i int) *int

IntToPtr returns the pointer to an int

func IsUUID added in v0.5.5

func IsUUID(str string) bool

IsUUID returns true if the given string is a valid UUID.

func IsValidInterpVariable added in v0.9.0

func IsValidInterpVariable(str string) bool

IsValidInterpVariable returns true if a valid dotted variable names for interpolation. The string must begin with one or more non-dot characters which may be followed by sequences containing a dot followed by a one or more non-dot characters.

func MapStringStringSliceValueSet

func MapStringStringSliceValueSet(m map[string][]string) []string

MapStringStringSliceValueSet returns the set of values in a map[string][]string

func SliceSetDisjoint

func SliceSetDisjoint(first, second []string) (bool, []string)

func SliceStringIsSubset

func SliceStringIsSubset(larger, smaller []string) (bool, []string)

SliceStringIsSubset returns whether the smaller set of strings is a subset of the larger. If the smaller slice is not a subset, the offending elements are returned.

func SliceStringToSet

func SliceStringToSet(s []string) map[string]struct{}

func StringToPtr added in v0.5.5

func StringToPtr(str string) *string

StringToPtr returns the pointer to a string

func TimeToPtr added in v0.5.5

func TimeToPtr(t time.Duration) *time.Duration

TimeToPtr returns the pointer to a time stamp

func Uint64Max added in v0.6.1

func Uint64Max(a, b uint64) uint64

func Uint64ToPtr added in v0.5.5

func Uint64ToPtr(u uint64) *uint64

Uint64ToPtr returns the pointer to an uint64

func UintToPtr added in v0.9.0

func UintToPtr(u uint) *uint

UintToPtr returns the pointer to an uint

Types

This section is empty.

Directories

Path Synopsis
BOLTdd contains a wrapper around BoltDB to deduplicate writes and encode values using mgspack.
BOLTdd contains a wrapper around BoltDB to deduplicate writes and encode values using mgspack.
constraints
semver
semver is a Semver Constraints package copied from github.com/hashicorp/go-version @ 2046c9d0f0b03c779670f5186a2a4b2c85493a71 Unlike Constraints in go-version, Semver constraints use Semver 2.0 ordering rules and only accept properly formatted Semver versions.
semver is a Semver Constraints package copied from github.com/hashicorp/go-version @ 2046c9d0f0b03c779670f5186a2a4b2c85493a71 Unlike Constraints in go-version, Semver constraints use Semver 2.0 ordering rules and only accept properly formatted Semver versions.
Copied from github.com/hashicorp/consul/sdk/freeport and tweaked for use by Nomad.
Copied from github.com/hashicorp/consul/sdk/freeport and tweaked for use by Nomad.
pluginutils
catalog
Package catalog is used to register internal plugins such that they can be loaded.
Package catalog is used to register internal plugins such that they can be loaded.
Package testlog creates a *log.Logger backed by *testing.T to ease logging in tests.
Package testlog creates a *log.Logger backed by *testing.T to ease logging in tests.
Package testtask implements a portable set of commands useful as stand-ins for user tasks.
Package testtask implements a portable set of commands useful as stand-ins for user tasks.

Jump to

Keyboard shortcuts

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