Documentation
¶
Index ¶
- func AsMap(v any) map[string]any
- func DirExists(path string) bool
- func FileExists(path string) bool
- func GetMap(m map[string]any, k string) map[string]any
- func GetSlice(m map[string]any, k string) []any
- func GetString(m map[string]any, k string) string
- func IsAllDigits(s string) bool
- func IsHex(s string) bool
- func IsUUID(s string) bool
- func OrDefault(key, fallback string) string
- func Truncate(s string, limit int) string
- func Unique[T comparable](s []T) []T
- func UniqueDirs(paths []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsMap ¶
AsMap asserts an arbitrary value (e.g. a range element) to map[string]any, returning nil when it is not a map — the value-based analogue of GetMap.
func FileExists ¶
FileExists reports whether path exists and is a regular file (not a directory).
func IsAllDigits ¶
IsAllDigits reports whether s is non-empty and every byte is an ASCII digit.
func IsHex ¶
IsHex reports whether s is non-empty and every byte is an ASCII hexadecimal digit (0-9, a-f, A-F).
func IsUUID ¶
IsUUID reports whether s is a canonical 8-4-4-4-12 hyphenated UUID: 36 bytes, ASCII hex with hyphens at positions 8, 13, 18, and 23.
func OrDefault ¶
OrDefault returns the value of the environment variable named key, or fallback if the variable is unset or empty.
func Truncate ¶
Truncate returns s truncated to at most limit runes. If s fits within limit, it is returned unchanged.
func Unique ¶
func Unique[T comparable](s []T) []T
Unique returns a new slice containing only the first occurrence of each element, preserving order.
func UniqueDirs ¶
UniqueDirs extracts the directory component of each path in paths and returns the unique set, preserving order of first occurrence.
Types ¶
This section is empty.