Documentation
¶
Index ¶
- func ClearDirectory(dir string) error
- func ConcatStr(sep string, str ...string) string
- func Contains[T comparable](items []T, item T) bool
- func CreateDirectory(path string) error
- func DetectMime(data []byte) *mimetype.MIME
- func Extension(file string) string
- func ExtractAlphaNum(str string, includes ...string) string
- func ExtractAlphaNumPersian(str string, includes ...string) string
- func ExtractNumbers(str string) string
- func FileExists(path string) (bool, error)
- func FindFile(dir string, pattern string) []string
- func FormatNumber(format string, v ...any) string
- func GetSubDirectory(dir string) ([]string, error)
- func HasError(err error) bool
- func If[T any](cond bool, yes T, no T) T
- func IsDirectory(path string) (bool, error)
- func IsErrorOf(tag string, err error) bool
- func PanicOnError(err error)
- func RandomString(n uint) (string, error)
- func RandomStringFromCharset(n uint, letters string) (res string, err error)
- func Slugify(str ...string) string
- func SlugifyPersian(str ...string) string
- func TaggedError(tags []string, format string, args ...any) error
- func VarOrPanic[T any](res T, err error) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDirectory ¶
ClearDirectory delete all files and sub-directory in directory
func Contains ¶ added in v1.7.1
func Contains[T comparable](items []T, item T) bool
Contains check if slice contains item
func CreateDirectory ¶
CreateDirectory create nested directory
func DetectMime ¶ added in v1.6.1
DetectMime detect file mime info from content
func ExtractAlphaNum ¶ added in v1.6.3
ExtractAlphaNum extract alpha and numbers from string [a-zA-Z0-9]
func ExtractAlphaNumPersian ¶ added in v1.6.3
ExtractAlphaNumPersian extract persian alpha, alpha and numbers from string [ا-یa-zA-Z0-9]
func ExtractNumbers ¶
ExtractNumbers extract numbers from string
func FormatNumber ¶ added in v1.3.0
FormatNumber format number with comma separator
func GetSubDirectory ¶
GetSubDirectory get list of sub directories
func IsDirectory ¶
IsDirectory check if path is directory
func RandomString ¶
RandomString generate random string from Alpha-Num Chars
func RandomStringFromCharset ¶
RandomStringFromCharset generate random string from character list
func SlugifyPersian ¶ added in v1.6.3
SlugifyPersian make slugify string for persian string
func TaggedError ¶ added in v1.3.0
TaggedError generate a tagged error
func VarOrPanic ¶ added in v1.7.2
VarOrPanic get function result (T, error)
if result has error generate panic return T otherwise
Types ¶
This section is empty.