util

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRegexpMatchMap

func BuildRegexpMatchMap(r HasSubexpNames, matches []string) map[string]string

BuildRegexpMatchMap creates a map from a regular expression, and a match slice obtained from r.FindStringSubmatch or r.FindAllStringSubmatch.

func CloseAndLogError

func CloseAndLogError(closer io.Closer)

CloseAndLogError closes the closer and logs any error it returns.

func EscapeName

func EscapeName(input string) string

EscapeName takes an arbitrary string and maps it bijectively to the grammar '^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'. This is useful when creating Kubernetes resources.

func FloatPointersPointToSameValue

func FloatPointersPointToSameValue(f1, f2 *float64) bool

FloatPointersPointToSameValue returns true if and only if: 1. f1 and f2 are the same pointer value. 2. f1 and f2 are both not nil and the floats to which they point are equal (==) or are both NaN.

func FormatTable

func FormatTable(rows [][]string) string

func NewBool added in v0.6.0

func NewBool(v bool) *bool

NewBool allocates a bool and initializes it to v.

func NewString

func NewString(v string) *string

NewString allocates a string and initializes it to v.

func TryParseInt64

func TryParseInt64(s string) *int64

TryParseInt64 is a convenience method to parse a string into an *int64, allowing only one or more ASCII digits and an optional sign prefix.

func UnescapeName

func UnescapeName(input string) (string, error)

UnescapeName performs the reverse transformation of EscapeName.

Types

type HasSubexpNames

type HasSubexpNames interface {
	SubexpNames() []string
}

Jump to

Keyboard shortcuts

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