utils

package
v0.13.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidatorFactory = new(VFactory)

Functions

func AppendToMap

func AppendToMap(gmap map[string]interface{}, mp map[string]string)

func ConfigAs

func ConfigAs[T any](mapping map[string]any, key string) T

func Contains

func Contains[K comparable, V any](mp map[K]V, keys ...K) bool

func ContainsString

func ContainsString(s []string, v string) bool

ContainsString returns true if a string is present in string slice

func ConvertToStringMap

func ConvertToStringMap(inputs map[string]interface{}) (map[string]string, error)

func CronIntervalValidator

func CronIntervalValidator(val interface{}, _ string) error

CronIntervalValidator return a nil value when a valid cron string is passed used in gopkg.in/validator.v2

func FromEnumProto

func FromEnumProto(typeProto, enumName string) string

FromEnumProto converts models to Types defined in protobuf, TYPE_TASK -> task

func IsPathOccupied

func IsPathOccupied(path string) (bool, error)

IsPathOccupied checks whether the targeted path is already occupied

func IsTerminal

func IsTerminal(f *os.File) bool

IsTerminal checks if file descriptor is terminal or not

func MapToList

func MapToList[V any](inputMap map[string]V) []V

func MergeAnyMaps

func MergeAnyMaps(maps ...map[string]interface{}) map[string]interface{}

func MergeMaps

func MergeMaps(maps ...map[string]string) map[string]string

MergeMaps can merge values from multiple maps into one It can also create clone of a map

func ToEnumProto

func ToEnumProto(modelType, enumName string) string

ToEnumProto converts models to Types defined in protobuf, task -> TYPE_TASK

func ValidateCronInterval

func ValidateCronInterval(val interface{}) error

ValidateCronInterval return a nil value when a valid cron string is passed

func WriteStringToFileIndexed

func WriteStringToFileIndexed() func(filePath, data string, writer io.Writer) error

Types

type VFactory

type VFactory struct{}

validatorFactory, name abbreviated so that the global implementation can be called 'validatorFactory'

func (*VFactory) NewFromRegex

func (*VFactory) NewFromRegex(re, message string) survey.Validator

Jump to

Keyboard shortcuts

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