util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 7 Imported by: 99

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppGitState  = ""
	AppGitCommit = ""
	AppVersion   = "canary"
)
View Source
var CertManagerUserAgent = "jetstack-cert-manager/" + version()

CertManagerUserAgent is the user agent that http clients in this codebase should use

Functions

func Contains

func Contains(ss []string, s string) bool

Contains returns true if a string is contained in a string slice

func ContextWithStopCh

func ContextWithStopCh(ctx context.Context, stopCh <-chan struct{}) context.Context

func EqualUnsorted

func EqualUnsorted(s1 []string, s2 []string) bool

func OnlyOneNotNil

func OnlyOneNotNil(items ...interface{}) (any bool, one bool)

func RandStringRunes

func RandStringRunes(n int) string

func RemoveDuplicates added in v0.2.1

func RemoveDuplicates(in []string) []string

func UserAgentRoundTripper added in v0.3.0

func UserAgentRoundTripper(inner http.RoundTripper) http.RoundTripper

UserAgentRoundTripper returns a RoundTripper that functions identically to the provided 'inner' round tripper, other than also setting a user agent.

Types

type FilterFn added in v0.1.0

type FilterFn func(string) (filter bool, err error)

FilterFn is a function used to filter a list of string. If the function returns false or a non-nil error, it will not be filtered.

type StringFilterT added in v0.1.0

type StringFilterT struct {
	String string
	Err    error
}

StringFilterT is a tuple for a value that has not been filtered out

type StringFilterWrapper added in v0.1.0

type StringFilterWrapper []StringFilterT

func StringFilter added in v0.1.0

func StringFilter(fn FilterFn, in ...string) StringFilterWrapper

StringFilter will run fn with each element of in, filtering out elements. it will return a slice of results where fn returned ok, or a non-nil error. it will also call each instance of fn in it's own goroutine.

func (StringFilterWrapper) Error added in v0.1.0

func (f StringFilterWrapper) Error() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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