Documentation ¶
Index ¶
- func AppendFile(filePath string, content string) error
- func CheckHash(input, hash string) error
- func Contains[T comparable](slice []T, element T) bool
- func CopyFile(src string, dst string) error
- func Env(name string, defaultValues ...string) string
- func EscapeQuery(query string) string
- func Filter[T any](slice []T, predicate func(T) bool) []T
- func GenerateHash(input string) (string, error)
- func GetMapKeys[K comparable, V any](m map[K]V) []K
- func GetMapValues[K comparable, V any](m map[K]V) []V
- func If[T any](condition bool, ifTrue T, ifFalse T) T
- func IfFn[T any](condition bool, ifTrue func() T, ifFalse func() T) T
- func IsFileExists(filePath string) bool
- func IsNumber(value any) bool
- func IsValidBool(v any) bool
- func IsValidFloat(v any) bool
- func IsValidInt(v any) bool
- func IsValidString(v any) bool
- func IsValidTime(v any) bool
- func IsValidUInt(v any) bool
- func Map[T any, R any](slice []T, mapper func(T) R) []R
- func MergeErrorMessages(errs ...error) error
- func MkDirs(dirs ...string) error
- func Must[T any](value T, err error) T
- func Pick(obj any, path string, defaultValues ...any) any
- func RandomString(length int) string
- func ReadCloserToString(rc io.ReadCloser) (string, error)
- func SecureRandomBytes(length int) ([]byte, error)
- func SliceEqual[T comparable](slice1 []T, slice2 []T) bool
- func SliceInsertBeforeElement[T comparable](slice []T, newElement T, checkIndexFn func(element T) bool) []T
- func WriteFile(filePath string, content string) error
- type HashConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶ added in v0.0.3
AppendFile appends the given content to the given file path. If the file does not exist, it creates the file.
func Contains ¶
func Contains[T comparable](slice []T, element T) bool
func EscapeQuery ¶
EscapeQuery escapes the query string to be used in a regular expression. copied from ent test
func GenerateHash ¶
func GetMapKeys ¶
func GetMapKeys[K comparable, V any](m map[K]V) []K
func GetMapValues ¶
func GetMapValues[K comparable, V any](m map[K]V) []V
func IsFileExists ¶
IsFileExists checks if the given file path exists.
func IsValidBool ¶
IsValidBool check if the given value is a valid boolean.
func IsValidFloat ¶
IsValidFloat check if the given value is a valid float.
func IsValidInt ¶
IsValidInt check if the given value is a valid integer.
func IsValidString ¶
IsValidString check if the given value is a valid string.
func IsValidTime ¶
IsValidTime check if the given value is a valid time.
func IsValidUInt ¶
IsValidUInt check if the given value is a valid unsigned integer.
func MergeErrorMessages ¶ added in v0.0.5
func RandomString ¶
func ReadCloserToString ¶ added in v0.0.5
func ReadCloserToString(rc io.ReadCloser) (string, error)
func SecureRandomBytes ¶
SecureRandomBytes returns the requested number of bytes using crypto/rand
func SliceEqual ¶
func SliceEqual[T comparable](slice1 []T, slice2 []T) bool
func SliceInsertBeforeElement ¶
func SliceInsertBeforeElement[T comparable](slice []T, newElement T, checkIndexFn func(element T) bool) []T