Documentation
¶
Index ¶
- func Contains[T comparable](slice []T, element T) bool
- func ContainsInt(slice []int, element int) bool
- func ContainsInt64(slice []int64, element int64) bool
- func ContainsLegacy(slice interface{}, element interface{}) bool
- func ContainsString(slice []string, element string) bool
- func ConvertToBool(value string) (bool, error)
- func ConvertToFloat(value string) (float64, error)
- func ConvertToInt(value string) (int, error)
- func ConvertToString(value interface{}) string
- func CreateDirRecursive(path string) error
- func CreateFile(path string) error
- func DeleteDirRecursive(path string) error
- func DeleteFile(path string) error
- func Exists(path string) bool
- func FormatFileSize(bytes int64) string
- func GenerateID(length int) string
- func IsEmpty[T comparable](v T) bool
- func IsEmptyLegacy(value interface{}) bool
- func IsEmptyMap[K comparable, V any](m map[K]V) bool
- func IsEmptySlice[T any](s []T) bool
- func IsEmptyString(s string) bool
- func MapKeys(m interface{}) []interface{}
- func MapValues(m interface{}) []interface{}
- func RemoveDuplicates[T comparable](slice []T) []T
- func RemoveDuplicatesInt(slice []int) []int
- func RemoveDuplicatesLegacy(slice interface{}) interface{}
- func RemoveDuplicatesString(slice []string) []string
- func Reverse[T any](slice []T)
- func ReverseInt64s(slice []int64)
- func ReverseInts(slice []int)
- func ReverseLegacy(slice interface{})
- func ReverseStrings(slice []string)
- func SliceToString(slice interface{}) string
- func SliceToStringInts(slice []int) string
- func SliceToStringStrings(slice []string) string
- func StringToSlice(str string) []string
- func TimeAgo(t time.Time) string
- func TruncateString(str string, length int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](slice []T, element T) bool
Contains checks if a slice contains an element - O(n)
func ContainsInt ¶
func ContainsInt64 ¶
func ContainsLegacy ¶
func ContainsLegacy(slice interface{}, element interface{}) bool
ContainsLegacy checks if a slice contains a specific element (fallback) This uses reflection for non-comparable types DEPRECATED: Use typed variants (ContainsString, ContainsInt, Contains[T]) when possible
func ContainsString ¶
Type-specific wrappers for Contains (for backward compatibility)
func ConvertToBool ¶
ConvertToBool converts string to bool
func ConvertToFloat ¶
ConvertToFloat converts string to float64
func ConvertToInt ¶
ConvertToInt converts string to int
func ConvertToString ¶
func ConvertToString(value interface{}) string
ConvertToString converts various types to string
func CreateDirRecursive ¶
func CreateFile ¶
func DeleteDirRecursive ¶
func DeleteFile ¶
func FormatFileSize ¶
FormatFileSize formats a file size in bytes to human readable format
func IsEmpty ¶
func IsEmpty[T comparable](v T) bool
IsEmpty checks if a comparable value equals its zero value
func IsEmptyLegacy ¶
func IsEmptyLegacy(value interface{}) bool
IsEmptyLegacy checks if a value is empty (fallback for non-comparable types) This is ONLY for types that cannot be handled by IsEmpty[T] DEPRECATED: Use typed variants (IsEmptyString, IsEmptySlice[T], etc.) when possible
func IsEmptyMap ¶
func IsEmptyMap[K comparable, V any](m map[K]V) bool
IsEmptyMap checks if a map is empty - O(1)
func IsEmptySlice ¶
IsEmptySlice checks if a slice is empty - O(1)
func IsEmptyString ¶
IsEmptyString checks if a string is empty - O(1)
func MapKeys ¶
func MapKeys(m interface{}) []interface{}
MapKeys returns the keys of a map as a slice
func MapValues ¶
func MapValues(m interface{}) []interface{}
MapValues returns the values of a map as a slice
func RemoveDuplicates ¶
func RemoveDuplicates[T comparable](slice []T) []T
RemoveDuplicates removes duplicate elements from a slice
func RemoveDuplicatesInt ¶
func RemoveDuplicatesLegacy ¶
func RemoveDuplicatesLegacy(slice interface{}) interface{}
RemoveDuplicatesLegacy removes duplicate elements from a slice (fallback with reflection) DEPRECATED: Use typed variants (RemoveDuplicatesString, RemoveDuplicatesInt, RemoveDuplicates[T]) when possible
func RemoveDuplicatesString ¶
Type-specific wrappers for RemoveDuplicates (for backward compatibility)
func ReverseInt64s ¶
func ReverseInt64s(slice []int64)
func ReverseInts ¶
func ReverseInts(slice []int)
func ReverseLegacy ¶
func ReverseLegacy(slice interface{})
ReverseLegacy reverses a slice in place (fallback with reflection) DEPRECATED: Use typed variants (ReverseStrings, ReverseInts, Reverse[T]) when possible
func ReverseStrings ¶
func ReverseStrings(slice []string)
Type-specific wrappers for Reverse (for backward compatibility)
func SliceToString ¶
func SliceToString(slice interface{}) string
SliceToString converts a slice of any type to a comma-separated string Uses reflection only as fallback - prefer typed variants when possible
func SliceToStringInts ¶
func SliceToStringStrings ¶
Type-specific wrappers for SliceToString
func StringToSlice ¶
StringToSlice converts a comma-separated string to a slice of strings
func TruncateString ¶
TruncateString truncates a string to a specified length
Types ¶
This section is empty.