utils

package
v0.0.0-...-7b190fc Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeys

func GetKeys[K comparable, V any](m map[K]V) []K

func IsYaml

func IsYaml(filePath string) bool

IsYaml checks if the file name or path contains a valid yaml extension

func MapEachSortedKeys

func MapEachSortedKeys[K constraints.Ordered, V any](m map[K]V, fu func(K, V) error) (err error)

func NewVT10XConsole

func NewVT10XConsole(opts ...expect.ConsoleOpt) (*expect.Console, error)

NewVT10XConsole returns a new expect.Console that multiplexes the Stdin/Stdout to a VT10X terminal, allowing Console to interact with an application sending ANSI escape sequences.

func ResolveHomeAbs

func ResolveHomeAbs(path string) (absPath string, err error)

ResolveHomeAbs resolves home directory or relative path into absolute path

func Retry

func Retry(maxRetries int, retryIntervalSec, jitterLimitSec int, fu func() error) error

Retry executes the provided function with Retry logic. in case of failures, the `fu` is retried `maxRetries` number of time, and wait for (`retryIntervalSec` + random `jitterLimitSec`) duration between each Retry.

func SetupDir

func SetupDir(dirPath string) (absDirPath string, err error)

SetupDir resolves home dir (`~`) or relative path and then creates directory if missing.

func ToCtyValue

func ToCtyValue(v interface{}) (out cty.Value, err error)

func ToIfaceArr

func ToIfaceArr[T any](arr []T) []interface{}

ToIfaceArr converts given T type array to interface array.

func ToRefArr

func ToRefArr[T any](arr []T) (refArr []*T)

ToRefArr convert array elements to reference

func TrimEmpty

func TrimEmpty[T comparable](arr []T) []T

TrimEmpty removes all empty elements from start and end of the array.

Types

This section is empty.

Jump to

Keyboard shortcuts

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