Documentation
¶
Index ¶
- Variables
- func AssembleServerPath(filepath string) string
- func ConvertRestfulURLToUri(url string) (string, string)
- func ConvertToRestfulURL(url string) string
- func DirIsEmpty(dirPath string) (bool, error)
- func DownloadFileAutoExt(url string, filepath string) (string, error)
- func FileIsExist(path string) (bool, error)
- func FunctionExists(dirPath, funcName string) (bool, error)
- func GenerateNoWhippletreeUuid() string
- func GenerateUuid() string
- func GetBrowser(userAgent string) string
- func GetCallerName(caller interface{}) string
- func GetClientRealIP(c *gin.Context) string
- func GetLocalIP() string
- func GetMapSpecificValue[T MapSupportedTypes](m map[string]interface{}, key string) T
- func GetMapValue[T any](m map[string]interface{}, key string) T
- func GetModuleName() (string, error)
- func GetPlatform(userAgent string) string
- func GetRequestPath(path, prefix string) (uri string, id int64)
- func GetServerAddr() string
- func InArray[T comparable](val T, slice []T) bool
- func Interval64(min, max int64) int64
- func IsValidNumber[T Number](value T) bool
- func JoinDomain(domain string, path string) string
- func LcFirst(s string) string
- func MakePasswd(pwd, salt string) string
- func Md5Encode(data string) string
- func RandString(n int) string
- func RemoveDomain(rawURL string) string
- func RunSafe(fn func())
- func SafeGo(fn func())
- func SaveFile(file *multipart.FileHeader, dst string) error
- func SeparateCamel(name, separator string) string
- func Ternary[T any](condition bool, trueVal, falseVal T) T
- func UcFirst(s string) string
- func ValidatePasswd(pwd, salt, passwd string) bool
- type MapSupportedTypes
- type Number
- type OrderlyMap
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ServerAddr string ServerIsTLS bool )
Functions ¶
func AssembleServerPath ¶
func ConvertRestfulURLToUri ¶
ConvertRestfulURLToUri 将REST ful URL转换为URI
func ConvertToRestfulURL ¶
ConvertToRestfulURL 将URI转换为REST ful URL
func DownloadFileAutoExt ¶
DownloadFileAutoExt 下载 URL 并保存到指定路径,第二个参数不要包含文件名 filepath: 文件保存路径, 会自动 md5 原URL 作为新文件的文件名
func FunctionExists ¶
func GetClientRealIP ¶
GetClientRealIP 获取客户端真实 IP(适用于 Gin 框架)
func GetMapSpecificValue ¶
func GetMapSpecificValue[T MapSupportedTypes](m map[string]interface{}, key string) T
GetMapSpecificValue 获取map的特定类型的值, 相较于GetMapValue, 不用每次反射获取值
func GetMapValue ¶
GetMapValue 获取map的值
func GetRequestPath ¶
GetRequestPath 获取请求路径
func Interval64 ¶
func JoinDomain ¶
JoinDomain 将域名和 URL 路径拼接为完整 URL
func RandString ¶
Types ¶
type OrderlyMap ¶
type OrderlyMap struct {
// contains filtered or unexported fields
}
有序 Map 严格按照Append的顺序执行, 先进先出, 同名会被覆盖
func NewOrderlyMap ¶
func NewOrderlyMap() *OrderlyMap
func (*OrderlyMap) Append ¶
func (self *OrderlyMap) Append(funcName string, value func())
func (*OrderlyMap) Foreach ¶
func (self *OrderlyMap) Foreach()
Click to show internal directories.
Click to hide internal directories.