utils

package
v2.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckInDir added in v2.10.0

func CheckInDir(root string, path string) error

func CheckSubInDir added in v2.11.2

func CheckSubInDir(root string, subDir string) error

func CompressGzip added in v2.20.0

func CompressGzip(input []byte, level int) ([]byte, error)

func DeepClone added in v2.23.5

func DeepClone[T any](src *T) (*T, error)

func DeepCopy

func DeepCopy(dst interface{}, src interface{}) error

func Exists

func Exists(path string) bool

func ExpandPath

func ExpandPath(p string) string

func FindStrInSlice

func FindStrInSlice(a []string, s string) int

func GetCacheDir added in v2.23.0

func GetCacheDir(ctx context.Context) string

func GetTmpBaseDir

func GetTmpBaseDir(ctx context.Context) string

func IntMax

func IntMax(a, b int) int

IntMax returns the maximum integer provided

func IntMin

func IntMin(a, b int) int

func IsDirectory

func IsDirectory(path string) bool

func IsFile

func IsFile(path string) bool

func NewGoHelper added in v2.18.4

func NewGoHelper(ctx context.Context, max int) *goHelper

func OpenBrowser added in v2.21.0

func OpenBrowser(url string) error

func ParseBoolOrDefault added in v2.22.0

func ParseBoolOrDefault(s string, def bool) bool

func ParseBoolOrFalse

func ParseBoolOrFalse(s string) bool

func ParseBoolOrFalsePtr added in v2.22.0

func ParseBoolOrFalsePtr(s *string) bool

func ParseEnvBool added in v2.13.0

func ParseEnvBool(name string, def bool) (bool, error)

func ParseEnvConfigList added in v2.16.0

func ParseEnvConfigList(prefix string) map[int]string

func Ptr added in v2.24.0

func Ptr[T any](v T) *T

func RandomString

func RandomString(n int) string

func RandomizeSuffix added in v2.24.0

func RandomizeSuffix(s string, randLen int, maxLen int) string

func RunParallelE added in v2.20.0

func RunParallelE(ctx context.Context, fs ...func() error) error

func RunWithDeadlineAndPanic added in v2.24.0

func RunWithDeadlineAndPanic(ctx context.Context, extraDeadline time.Duration, f func() error) error

func Sha256Bytes

func Sha256Bytes(data []byte) string

func Sha256String

func Sha256String(data string) string

func StrPtrEquals added in v2.21.0

func StrPtrEquals(s1 *string, s2 *string) bool

func Touch

func Touch(path string) error

func UncompressGzip added in v2.20.0

func UncompressGzip(input []byte) ([]byte, error)

func WithCacheDir added in v2.23.0

func WithCacheDir(ctx context.Context, cacheDir string) context.Context

func WithTmpBaseDir added in v2.18.0

func WithTmpBaseDir(ctx context.Context, tmpBaseDir string) context.Context

Types

type EnvSet added in v2.22.0

type EnvSet struct {
	Index int
	Map   map[string]string
}

func ParseEnvConfigSets

func ParseEnvConfigSets(prefix string) []EnvSet

type Inclusion

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

func NewInclusion

func NewInclusion() *Inclusion

func (*Inclusion) AddExclude

func (inc *Inclusion) AddExclude(typ string, value string)

func (*Inclusion) AddInclude

func (inc *Inclusion) AddInclude(typ string, value string)

func (*Inclusion) CheckIncluded

func (inc *Inclusion) CheckIncluded(l []InclusionEntry, excludeIfNotIncluded bool) bool

func (*Inclusion) GetExcludes added in v2.20.0

func (inc *Inclusion) GetExcludes(typ string) []string

func (*Inclusion) GetIncludes added in v2.20.0

func (inc *Inclusion) GetIncludes(typ string) []string

func (*Inclusion) HasType

func (inc *Inclusion) HasType(typ string) bool

type InclusionEntry

type InclusionEntry struct {
	Type  string
	Value string
}

type OnceByKey

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

func (*OnceByKey) Do

func (o *OnceByKey) Do(key string, cb func())

type OrderedMap

type OrderedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*OrderedMap[K, V]) ForEach added in v2.22.0

func (s *OrderedMap[K, V]) ForEach(cb func(k K, v V))

func (*OrderedMap[K, V]) Get

func (s *OrderedMap[K, V]) Get(k K) (V, bool)

func (*OrderedMap[K, V]) Has

func (s *OrderedMap[K, V]) Has(k K) bool

func (*OrderedMap[K, V]) Len added in v2.22.0

func (s *OrderedMap[K, V]) Len() int

func (*OrderedMap[K, V]) ListKeys

func (s *OrderedMap[K, V]) ListKeys() []K

func (*OrderedMap[K, V]) ListValues

func (s *OrderedMap[K, V]) ListValues() []V

func (*OrderedMap[K, V]) Merge added in v2.9.0

func (s *OrderedMap[K, V]) Merge(other *OrderedMap[K, V])

func (*OrderedMap[K, V]) Set

func (s *OrderedMap[K, V]) Set(k K, v V) bool

func (*OrderedMap[K, V]) SetMultiple added in v2.9.0

func (s *OrderedMap[K, V]) SetMultiple(k []K, v V)

type PrettyTable

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

func (*PrettyTable) AddRow

func (t *PrettyTable) AddRow(c ...string)

func (*PrettyTable) Render

func (t *PrettyTable) Render(limitWidths []int) string

func (*PrettyTable) SortRows

func (t *PrettyTable) SortRows(col int)

type Row

type Row []string

type ThreadSafeCache

type ThreadSafeCache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*ThreadSafeCache[K, V]) Clear added in v2.22.0

func (c *ThreadSafeCache[K, V]) Clear()

func (*ThreadSafeCache[K, V]) ForEach added in v2.22.0

func (c *ThreadSafeCache[K, V]) ForEach(cb func(k K, v V))

func (*ThreadSafeCache[K, V]) Get

func (c *ThreadSafeCache[K, V]) Get(key K, f func() (V, error)) (V, error)

type ThreadSafeMultiCache

type ThreadSafeMultiCache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*ThreadSafeMultiCache[K, V]) Get

func (c *ThreadSafeMultiCache[K, V]) Get(cacheKey string, key K, f func() (V, error)) (V, error)

Directories

Path Synopsis
conditions
Package conditions provides utilities for manipulating the status conditions of Kubernetes resource objects that implement the Getter and/or Setter interfaces.
Package conditions provides utilities for manipulating the status conditions of Kubernetes resource objects that implement the Getter and/or Setter interfaces.
metrics
Package metrics contains a Recorder and helpers for recoding standard metrics for all GitOps Toolkit components.
Package metrics contains a Recorder and helpers for recoding standard metrics for all GitOps Toolkit components.

Jump to

Keyboard shortcuts

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