util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToPtr

func BoolToPtr(b bool) *bool

func BoolToStr

func BoolToStr(b bool, ifTrue string, ifFalse string) string

func DefaultBoolIfNil

func DefaultBoolIfNil(b *bool, defaultB bool) bool

func DefaultIfError

func DefaultIfError(fn StringerWithError, defaultS string) string

func DefaultIfNil

func DefaultIfNil(s *string, defaultS string) string

func DefaultIfNotInMap added in v0.2.0

func DefaultIfNotInMap(m map[string]string, key string, def string) string

func DefaultString

func DefaultString(s string, defaultS string) string

func Empty added in v0.2.1

func Empty[T any]() T

func FromPtr added in v0.2.1

func FromPtr[T any](x *T) T

func GetResourceOwner

func GetResourceOwner(owner *string) (string, string, error)

func Int32ToPtrWithNilDefault

func Int32ToPtrWithNilDefault(i int32) *int32

func Int64ToPtr

func Int64ToPtr(i int64) *int64

func IntToPtr

func IntToPtr(i int) *int

func IsEmptyString

func IsEmptyString(s *string) bool

func LabelArrayToMap

func LabelArrayToMap(labels []string) map[string]string

func LabelMapToArray

func LabelMapToArray(labels *map[string]string) []string

func LabelsMatchLabelSelector

func LabelsMatchLabelSelector(labels map[string]string, labelSelector map[string]string) bool

func MergeLabels

func MergeLabels(labels ...map[string]string) map[string]string

func Must

func Must(err error)

func MustString

func MustString(fn StringerWithError) string

func OwnerQueryParamsToArray

func OwnerQueryParamsToArray(ownerQueryParam *string) []string

func SetResourceOwner

func SetResourceOwner(kind string, name string) *string

func SingleQuote

func SingleQuote(input []string) []string

func SliceToPtrWithNilDefault

func SliceToPtrWithNilDefault(s []string) *[]string

func StrToPtr

func StrToPtr(s string) *string

func StrToPtrWithNilDefault

func StrToPtrWithNilDefault(s string) *string

func TimeStampStringPtr

func TimeStampStringPtr() *string

func TimeToPtr

func TimeToPtr(t time.Time) *time.Time

Types

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) String

func (d Duration) String() string

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type StringerWithError

type StringerWithError func() (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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