util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Coalesce

func Coalesce(val, defaultVal string) string

Coalesce returns the first argument if it is not null, otherwise the second one.

func Diff

func Diff(a, b interface{}) []string

Diff returns diffs between 2 objects

func FindNamedStringSubmatch

func FindNamedStringSubmatch(r *regexp.Regexp, s string) map[string]string

FindNamedStringSubmatch returns a map of strings holding the text of the matches of the r regular expression

func MapContains

func MapContains(haystack, needle map[string]string) bool

MapContains returns true if and only if haystack contains all the keys from the needle with matching corresponding values

func NameFromMeta

func NameFromMeta(meta metav1.ObjectMeta) spec.NamespacedName

NameFromMeta converts a metadata object to the NamespacedName name representation.

func PGUserPassword

func PGUserPassword(user spec.PgUser) string

PGUserPassword is used to generate md5 password hash for a given user. It does nothing for already hashed passwords.

func PrettyDiff

func PrettyDiff(a, b interface{}) string

PrettyDiff shows the diff between 2 objects in an easy to understand format. It is mainly used for debugging output.

func RandomPassword

func RandomPassword(n int) string

RandomPassword generates random alphanumeric password of a given length.

func RequestIsSmallerThanLimit added in v1.1.0

func RequestIsSmallerThanLimit(requestStr, limitStr string) (bool, error)

RequestIsSmallerThanLimit

func SubstractStringSlices

func SubstractStringSlices(a []string, b []string) (result []string, equal bool)

SubstractStringSlices finds elements in a that are not in b and return them as a result slice.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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