Documentation ¶
Index ¶
- func ArrayChunk[T any](arr []T, size int) [][]T
- func GenerateBaseSnowId(num int, n *snowflake.Node) string
- func GenerateHash(str string) string
- func GeneratePasswordHash(password string, salt string) string
- func GenerateUuid(size int) string
- func GetAllDirs(root string) ([]string, error)
- func GetFileNamesByDirPath(root string) ([]map[string]interface{}, error)
- func GetKeyByMap[T comparable](m map[string]T, value T) string
- func GetLocalIp() (string, error)
- func GetLocalIpToInt() (int, error)
- func GetProjectModuleName() string
- func GetStructColumnName(s interface{}, _type int) ([]string, error)
- func InAnyMap[T comparable](haystack map[string]T, needle T) bool
- func InAnySlice[T comparable](haystack []T, needle T) bool
- func IsPathExist(path string) bool
- func MakeFileOrPath(path string) (*os.File, error)
- func MakeMultiDir(filePath string) error
- func MakeTimeFormatDir(rootPath, pathName, timeFormat string) (string, error)
- func RandString(length int) string
- func String2Int(strArr []string) []int
- func ToCamelCase(s string) string
- func WriteContentToFile(file *multipart.FileHeader, filePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateBaseSnowId ¶
GenerateBaseSnowId 生成雪花算法ID
func GeneratePasswordHash ¶
GeneratePasswordHash 生成密码hash值
func GetFileNamesByDirPath ¶
GetFileNamesByDirPath 获取当前文件夹下的所有文件和文件夹名称(包括子文件夹和文件)
func GetKeyByMap ¶
func GetKeyByMap[T comparable](m map[string]T, value T) string
GetKeyByMap 根据map中的值获取键
func GetStructColumnName ¶
GetStructColumnName 获取结构体中的字段名称 _type: 1: 获取tag字段值 2:获取结构体字段值
func InAnyMap ¶
func InAnyMap[T comparable](haystack map[string]T, needle T) bool
InAnyMap 判断某个map的值是否存在
func InAnySlice ¶
func InAnySlice[T comparable](haystack []T, needle T) bool
InAnySlice 判断某个字符串是否在字符串切片中
func MakeTimeFormatDir ¶
MakeTimeFormatDir @Description: 创建时间格式的目录 如:upload/{path}/2023-01-07/ @param rootPath 根目录 @param pathName 子目录名称 @param timeFormat 时间格式 如:2006-01-02、20060102 @return string @return error
func WriteContentToFile ¶
func WriteContentToFile(file *multipart.FileHeader, filePath string) error
WriteContentToFile @Description: 写文件 @param filePath @return error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.