Versions in this module Expand all Collapse all v1 v1.24.5 Aug 14, 2025 Changes in this version + var ErrAlreadyExist = errors.New("resource already exists") + var ErrInvalidArgument = errors.New("invalid argument") + var ErrNotEmpty = errors.New("not-empty") + var ErrNotExist = errors.New("resource does not exist") + var ErrPermissionDenied = errors.New("permission denied") + var ErrUnprocessableContent = errors.New("unprocessable content") + func AESGCMDecrypt(key, ciphertext []byte) ([]byte, error) + func AESGCMEncrypt(key, plaintext []byte) ([]byte, error) + func ApplyUmask(f string, newMode os.FileMode) error + func CallerFuncName(skip int) string + func ContrastColor(backgroundColor string) string + func CopyFile(src, dest string) error + func CreatePublicKeyFingerprint(key crypto.PublicKey) ([]byte, error) + func CryptoRandomBytes(length int64) ([]byte, error) + func CryptoRandomInt(limit int64) (int64, error) + func CryptoRandomString(length int64) (string, error) + func Debounce(d time.Duration) func(f func()) + func EllipsisDisplayString(str string, limit int) string + func EllipsisDisplayStringX(str string, limit int) (left, right string) + func EllipsisTruncateRunes(str string, limit int) (left, right string) + func ErrorWrap(unwrap error, message string, args ...any) error + func ErrorWrapLocale(err error, trKey string, trArgs ...any) error + func FilePathJoinAbs(base string, sub ...string) string + func FileURLToPath(u *url.URL) (string, error) + func GenerateKeyPair(bits int) (string, string, error) + func GetRelativeLuminance(color string) float64 + func HexToRBGColor(colorString string) (float64, float64, float64) + func HomeDir() (home string, err error) + func IfEmpty[T any](v, def []T) []T + func IfZero[T comparable](v, def T) T + func Iif[T any](condition bool, trueVal, falseVal T) T + func IsCommonHiddenFileName(name string) bool + func IsDir(dir string) (bool, error) + func IsEmptyReader(r io.Reader) (err error) + func IsEmptyString(s string) bool + func IsExist(path string) (bool, error) + func IsFile(filePath string) (bool, error) + func IsLikelyEllipsisLeftPart(s string) bool + func IsReadmeFileExtension(name string, ext ...string) (int, bool) + func IsReadmeFileName(name string) bool + func KeysOfMap[K comparable, V any](m map[K]V) []K + func ListDirRecursively(rootDir string, opts *ListDirOptions) (res []string, err error) + func NewAlreadyExistErrorf(message string, args ...any) error + func NewInvalidArgumentErrorf(message string, args ...any) error + func NewNotExistErrorf(message string, args ...any) error + func NewPermissionDeniedErrorf(message string, args ...any) error + func NormalizeEOL(input []byte) []byte + func OptionalArg[T any](optArg []T, defaultValue ...T) (ret T) + func PackData(data ...any) ([]byte, error) + func PaginateSlice(list any, page, pageSize int) any + func PathEscapeSegments(path string) string + func PathJoinRel(elem ...string) string + func PathJoinRelX(elem ...string) string + func ReadAtMost(r io.Reader, buf []byte) (n int, err error) + func ReadWithLimit(r io.Reader, n int) (buf []byte, err error) + func Remove(name string) error + func RemoveAll(name string) error + func Rename(oldpath, newpath string) error + func ReserveLineBreakForTextarea(input string) string + func SanitizeCredentialURLs(s string) string + func SanitizeErrorCredentialURLs(err error) error + func SanitizeURL(s string) (string, error) + func SecToHours(durationVal any) string + func ShellEscape(toEscape string) string + func SliceContainsString(slice []string, target string, insensitive ...bool) bool + func SliceNilAsEmpty[T any](a []T) []T + func SliceRemoveAll[T comparable](slice []T, target T) []T + func SliceSortedEqual[T comparable](s1, s2 []T) bool + func Sorted[S ~[]E, E cmp.Ordered](values S) S + func SplitTrimSpace(input, sep string) []string + func TimeEstimateParse(timeStr string) (int64, error) + func TimeEstimateString(amount int64) string + func ToFloat64(number any) (float64, error) + func ToInt64(number any) (int64, error) + func ToPointer[T any](val T) *T + func ToSnakeCase(input string) string + func ToTitleCase(s string) string + func ToTitleCaseNoLower(s string) string + func ToUpperASCII(s string) string + func TruncateRunes(str string, limit int) string + func URLJoin(base string, elems ...string) string + func UnpackData(buf []byte, data ...any) error + func UnsafeBytesToString(b []byte) string + func UnsafeStringToBytes(s string) []byte + func UseLightText(backgroundColor string) bool + func ValuesOfMap[K comparable, V any](m map[K]V) []V + type CountingReader struct + func NewCountingReader(rd io.Reader) *CountingReader + func (w *CountingReader) Count() int + func (w *CountingReader) Read(p []byte) (int, error) + type ListDirOptions struct + IncludeDir bool + SkipCommonHiddenNames bool + type LocaleWrapper struct + TrArgs []any + TrKey string + func ErrorAsLocale(err error) *LocaleWrapper + func (w LocaleWrapper) Error() string + func (w LocaleWrapper) Unwrap() error + type NopCloser struct + func (NopCloser) Close() error