util

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add added in v0.12.0

func Add(original *map[string]string, toAdd map[string]string, toRemove []string) map[string]string

func AddedAndRemovalListsFromArray added in v0.12.0

func AddedAndRemovalListsFromArray(m []string) ([]string, []string)

AddedAndRemovalListsFromArray returns a list of added entries and a list of removal entries

func ContainsAll

func ContainsAll(target string, substrings ...string) cmp.Comparison

ContainsAll is a comparison utility, compares given substrings against target string and returns the gotest.tools/assert/cmp.Comaprison function. Provide target string as first arg, followed by any number of substring as args

func ContainsAllIgnoreCase

func ContainsAllIgnoreCase(target string, substrings ...string) cmp.Comparison

Like ContainsAll but ignores the case when checking

func ContainsNone

func ContainsNone(target string, substrings ...string) cmp.Comparison

ContainsNone is a comparison utility, compares given substrings against target string and returns the gotest.tools/assert/cmp.Comaprison function. Provide target string as first arg, followed by any number of substring as args

func GetGroupVersionKind

func GetGroupVersionKind(obj runtime.Object, gv schema.GroupVersion, scheme *runtime.Scheme) (*schema.GroupVersionKind, error)

func MapFromArray

func MapFromArray(arr []string, delimiter string) (map[string]string, error)

func MapFromArrayAllowingSingles

func MapFromArrayAllowingSingles(arr []string, delimiter string) (map[string]string, error)

func NewLoggingTransport

func NewLoggingTransport(transport http.RoundTripper) http.RoundTripper

func NewLoggingTransportWithStream

func NewLoggingTransportWithStream(transport http.RoundTripper, s io.Writer) http.RoundTripper

func ParseMinusSuffix added in v0.12.0

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

func SliceContainsIgnoreCase added in v0.13.0

func SliceContainsIgnoreCase(slice []string, target string) bool

SliceContainsIgnoreCase checks (case insensitive) if given target string is present in slice

func UpdateGroupVersionKindWithScheme

func UpdateGroupVersionKindWithScheme(obj runtime.Object, gv schema.GroupVersion, scheme *runtime.Scheme) error

Types

type LoggingHttpTransport

type LoggingHttpTransport struct {
	// contains filtered or unexported fields
}

func (*LoggingHttpTransport) RoundTrip

func (t *LoggingHttpTransport) RoundTrip(r *http.Request) (*http.Response, error)

type OrderedMap added in v0.10.0

type OrderedMap struct {
	Keys     []string
	ValueMap map[string]*valueEntry
}

OrderedMap is similar implementation of OrderedDict in Python.

func NewOrderedMap added in v0.10.0

func NewOrderedMap() *OrderedMap

NewOrderedMap returns new empty ordered map

func NewOrderedMapWithKVStrings added in v0.10.0

func NewOrderedMapWithKVStrings(kvList [][]string) *OrderedMap

NewOrderedMapWithKVStrings returns new empty ordered map

func OrderedMapAndRemovalListFromArray added in v0.10.0

func OrderedMapAndRemovalListFromArray(arr []string, delimiter string) (*OrderedMap, []string, error)

OrderedMapAndRemovalListFromArray creates a list of key-value pair using MapFromArrayAllowingSingles, and a list of removal entries

func (*OrderedMap) Delete added in v0.10.0

func (o *OrderedMap) Delete(key string)

Delete deletes the key and value from the map

func (*OrderedMap) Get added in v0.10.0

func (o *OrderedMap) Get(key string) (interface{}, bool)

Get returns a value corresponding the key

func (*OrderedMap) GetString added in v0.10.0

func (o *OrderedMap) GetString(key string) (string, bool)

GetString returns a string value corresponding the key

func (*OrderedMap) GetStringWithDefault added in v0.10.0

func (o *OrderedMap) GetStringWithDefault(key string, defaultValue string) string

GetStringWithDefault returns a string value corresponding the key if the key is existing. Otherwise, the default value is returned.

func (*OrderedMap) Iterator added in v0.10.0

func (o *OrderedMap) Iterator() *orderedMapIterator

Iterator creates a iterator object

func (*OrderedMap) Len added in v0.10.0

func (o *OrderedMap) Len() int

Len returns a size of the ordered map

func (*OrderedMap) Set added in v0.10.0

func (o *OrderedMap) Set(key string, value interface{})

Set append the key and value if the key is not existing on the map Otherwise, the value does just replace the old value corresponding to the key.

type StringMap added in v0.12.0

type StringMap map[string]string

StringMap is a map which key and value are strings

func (StringMap) Merge added in v0.12.0

func (m StringMap) Merge(toMerge map[string]string) StringMap

Merge to merge a map to a StringMap

func (StringMap) Remove added in v0.12.0

func (m StringMap) Remove(toRemove []string) StringMap

Remove to remove from StringMap

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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