utils

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareStringSlices

func CompareStringSlices(a, b []string) bool

CompareStringSlices does two string array comparison

func HasOneOfPrefixes

func HasOneOfPrefixes(s string, prefixes ...string) bool

HasOneOfPrefixes returns true if the provided string starts with any of the specified prefixes

func MatchesLabels

func MatchesLabels(targetLabels, wantedLabels map[string]string) bool

MatchesLabels determines whether a set of "target" labels matches the set of "wanted" labels

func StringInSlice

func StringInSlice(haystack []string, needle string) bool

StringInSlice returns true if needle is within haystack

func StringsInSlice

func StringsInSlice(haystack []string, needles ...string) bool

StringsInSlice returns true if needles are within haystack

Types

type StringSet

type StringSet map[string]struct{}

StringSet is a set of unique strings

func NewStringSet

func NewStringSet() StringSet

NewStringSet returns new string set

func NewStringSetFromSlice

func NewStringSetFromSlice(slice []string) StringSet

NewStringSetFromSlice creates stringset from slice

func (StringSet) Add

func (s StringSet) Add(v string)

Add adds a string to set

func (StringSet) AddSet

func (s StringSet) AddSet(right StringSet)

AddSet joins two sets

func (StringSet) AddSlice

func (s StringSet) AddSlice(slice []string)

AddSlice appends elements of slice to set

func (StringSet) Has

func (s StringSet) Has(item string) (exists bool)

Has checks whether argument is present in set

func (StringSet) Remove

func (s StringSet) Remove(v string)

Remove removes string from set

func (StringSet) Slice

func (s StringSet) Slice() (slice []string)

Slice converts string into slice

Jump to

Keyboard shortcuts

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