util

package
v0.0.0-...-b8a7cb5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(slice []string, value string) bool

func DeploymentCreateToUpdate

func DeploymentCreateToUpdate(create body.DeploymentCreate) body.DeploymentUpdate

func DownloadFile

func DownloadFile(filepath string, url string) error

func EnsureFileExists

func EnsureFileExists(path string) error

func FileExists

func FileExists(path string) (bool, error)

func Float64Pointer

func Float64Pointer(f float64) *float64

func GetCommonDomain

func GetCommonDomain(domains ...string) (string, error)

GetCommonDomain returns the common domain from multiple domains by removing subdomains. It assumes domains provided are hosts without a scheme.

func GetNameFromUser

func GetNameFromUser() (string, error)

func GetNames

func GetNames(apiKeys []body.ApiKey) []string

func HandleResponse

func HandleResponse(response *resty.Response) error

func IfNotNilDo

func IfNotNilDo[T any](e *T, action func())

func IntPointer

func IntPointer(i int) *int

func IsEmptyOrNil

func IsEmptyOrNil(image *string) bool

func IsValidDeplName

func IsValidDeplName(name string) bool

func NotNilOrEmpty

func NotNilOrEmpty(image *string) bool

func Or

func Or[T comparable](vals ...T) T

Returns the first non default value, fallback is default value

func ProcessResponse

func ProcessResponse[T any](responseBody string) (*T, error)

func ProcessResponseArr

func ProcessResponseArr[T any](responseBody string) ([]T, error)

func ProcessUserReadResponse

func ProcessUserReadResponse(responseBody string) ([]body.UserRead, error)

func PtrOr

func PtrOr[T comparable](ptr *T, vals ...T) T

Like Or but the first argument is a pointer, that if it is not nil is used

func SafeSend

func SafeSend[T any](ch chan T, data T)

func SetupSignalHandler

func SetupSignalHandler(done chan bool, handler func())

func TimeAgo

func TimeAgo(t *time.Time) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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