Documentation
¶
Index ¶
- func AppendStringUnique(slice []string, value string) []string
- func AppendUnique(a, b []string) []string
- func ArgsReorg(args ...string) []string
- func AssertInteger(op string, value int, test int) bool
- func AssertString(op string, value string, test string) bool
- func AssertSwitch(value string, test map[string]interface{}) string
- func CalculateMemoryUsage(v interface{}, visited map[uintptr]bool) uintptr
- func CleanSlashes(paths ...string) []string
- func CloneOf(entity interface{}) (interface{}, bool)
- func DebugAsPrettyJsonToBytes(lookupContext any) ([]byte, error, error)
- func DecodeToMap(input interface{}) (map[string]interface{}, error)
- func EscapeChars(s string, charsToEscape string, escapeChar string) string
- func EscapeRedisValue(query string) string
- func ExprToString(expr ast.Expr) string
- func FieldValue(obj interface{}, field string) (interface{}, bool)
- func FindFileDown(dir, filename string) (string, error)
- func FindFileUp(filename string) (string, error)
- func FindStringIndex(slice []string, target string) int
- func Fprintf(w *os.File, format string, args ...interface{}) (n int)
- func Fprintln(w *os.File, format string) (n int)
- func FromMap(c interface{}, record map[string]interface{}) error
- func GetFunctionOptions(key string, defaultValue interface{}, options ...map[string]interface{}) (result interface{})
- func GetModuleFromGoMod() (string, error)
- func GetRootPathGoMod() (string, error)
- func IsBytesIsInt(value []byte) (intValue int, isInt bool)
- func IsEmptyReflectValue(v reflect.Value) bool
- func IsEmptyValue(value any) bool
- func IsNil(value interface{}) bool
- func IsNumeric(i interface{}) bool
- func IsPathExists(data map[string]interface{}, path []string) bool
- func IsPointer(v interface{}) bool
- func IsSlice(t interface{}) bool
- func IsString(i interface{}) bool
- func IsStruct(v any) bool
- func Len(v interface{}) int
- func MapKey(m *map[string]interface{}, key string) map[string]interface{}
- func MapPtrKey(m *map[string]interface{}, key string) *map[string]interface{}
- func MergeMaps(dst, src map[string]interface{}) map[string]interface{}
- func MergeMapsLevel0(maps ...map[string]interface{}) map[string]interface{}
- func MergeObjectsToMap(exclude map[string]interface{}, objs ...interface{}) *map[string]interface{}
- func MustArray(i interface{}, byDefault ...[]interface{}) (arrayValue []interface{}, isType string)
- func MustBool(i interface{}, byDefault ...bool) (boolValue bool, isType string)
- func MustInt(i interface{}, byDefault ...int) (intValue int, isType string)
- func MustString(i interface{}, byDefault ...string) (stringValue string, isType string)
- func NaturalLess(a, b string) bool
- func NowAsString() string
- func SanitizeServiceName(input string) string
- func SetFieldValue(obj interface{}, field string, value any) (interface{}, bool)
- func SetFieldValueInt(obj interface{}, field string, value int) (interface{}, bool)
- func SetFieldValueString(obj interface{}, field string, value string) (interface{}, bool)
- func SplitString(item string, s string) (string, string)
- func TimeToString(t time.Time) string
- func ToCamelCase(input string) string
- func ToMap(c interface{}) (map[string]interface{}, error)
- func ToMapRecursive(c interface{}) (map[string]interface{}, error)
- func ToSnakeCase(input string) string
- func TouchFile(name string) error
- func UpdateMap(dst *map[string]interface{}, src map[string]interface{})
- func UpdateMaps(maps ...*map[string]interface{}) *map[string]interface{}
- type NaturalSort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendStringUnique ¶
AppendStringUnique appends a string to a slice if it is not already in the slice
func AppendUnique ¶
AppendUnique appends all unique values from b to a
func AssertInteger ¶
AssertInteger performs a comparison between an integer value and a test integer based on the provided operator. Supported operators: gt, lt, eq, ne, ge, le
func AssertString ¶
AssertString performs a comparison between a string value and a test string based on the provided operator. Supported operators: eq, ne
func AssertSwitch ¶
func CalculateMemoryUsage ¶
CalculateMemoryUsage estimates the memory usage of an interface{} and all its nested elements
func CleanSlashes ¶
CleanSlashes removes leading and trailing slashes from a string.
func CloneOf ¶
func CloneOf(entity interface{}) (interface{}, bool)
CloneOf returns a deep copy of the given entity
func DebugAsPrettyJsonToBytes ¶
DebugAsPrettyJsonToBytes returns the lookup context as a pretty json string
func DecodeToMap ¶
DecodeToMap decodes an interface{} into a map[string]interface{}
func EscapeChars ¶
EscapeChars Function to escape a set of characters in a string
func EscapeRedisValue ¶
EscapeRedisValue Function to escape a string for use in a Redis query
func ExprToString ¶
func FieldValue ¶
FieldValue returns the value of a field in a struct or map
func FindFileDown ¶
FindFileDown searches for a file in a directory and its subdirectories. It returns the path to the file if found, or an error if the file is not found.
func FindFileUp ¶
FindFileUp searches for a file in the current directory and its parent directories. It returns the path to the file if found, or an error if the file is not found.
func FindStringIndex ¶
FindStringIndex Function to find the index of a string in a slice of strings Returns -1 if the string is not found
func Fprintf ¶
Fprintf writes to the given writer using the format specifier format, substituting any instances of %s or %v according to the format specifiers, writing to os.Stdout if no writer is provided.
func Fprintln ¶
Fprintln writes the text to the given writer, followed by a newline character, writing to os.Stdout if no writer is provided.
func GetFunctionOptions ¶
func GetModuleFromGoMod ¶
GetModuleFromGoMod returns the module name from the go.mod file.
func GetRootPathGoMod ¶
GetRootPathGoMod returns the root path of the Go module.
func IsBytesIsInt ¶
IsBytesIsInt checks if a byte slice is a valid integer
func IsEmptyReflectValue ¶
func IsEmptyValue ¶
func IsPathExists ¶
IsPathExists checks if a nested path exists in a map[string]interface{}
func IsSlice ¶
func IsSlice(t interface{}) bool
IsSlice returns true if the given interface is a slice
func MergeMapsLevel0 ¶
MergeMapsLevel0 merges multiple maps into a single map without recursion.
func MergeObjectsToMap ¶
MergeObjectsToMap merges multiple objects into a single map, excluding keys specified in the exclude map.
func MustArray ¶
func MustArray(i interface{}, byDefault ...[]interface{}) (arrayValue []interface{}, isType string)
func MustString ¶
func NaturalLess ¶
NaturalLess compares two strings in natural order.
func NowAsString ¶
func NowAsString() string
NowAsString returns the current time as a string in RFC3339 format
func SanitizeServiceName ¶
func SetFieldValue ¶
SetFieldValue sets the value of a field in a struct or map
func SetFieldValueInt ¶
SetFieldValueInt sets the value of a field in a struct or map
func SetFieldValueString ¶
SetFieldValueString sets the value of a field in a struct or map
func TimeToString ¶
TimeToString converts a time.Time to a string in RFC3339 format
func ToCamelCase ¶
func ToMapRecursive ¶
ToMapRecursive converts a struct to a map[string]interface{} recursively
func ToSnakeCase ¶
ToSnakeCase converts a string to snake_case
func TouchFile ¶
TouchFile creates an empty file if it doesn't exist or updates the modification time if it does. It returns an error if the operation fails.
func UpdateMaps ¶
UpdateMaps merges multiple maps into a single map. The first map is modified in place and returned as a pointer. If the first map is nil, a new map is created.
Types ¶
type NaturalSort ¶
type NaturalSort []string
func (NaturalSort) Len ¶
func (ns NaturalSort) Len() int
func (NaturalSort) Less ¶
func (ns NaturalSort) Less(i, j int) bool
func (NaturalSort) Swap ¶
func (ns NaturalSort) Swap(i, j int)