Documentation ¶
Index ¶
- func AddSlashes(str string) string
- func ArrayColumn[M ~[]map[K]V, K comparable, V any](m M, key K) []V
- func ArrayDiff[V comparable](array1 []V, arrayOthers ...[]V) []V
- func ArrayIn[V comparable](needle V, haystack []V) bool
- func ArrayIntersect[V comparable](array1 []V, arrayOthers ...[]V) []V
- func ArrayKey[M ~map[K]V, K comparable, V any](m M) []K
- func ArraySearch[V comparable](needle V, haystack []V) int
- func ArrayUnique[V comparable](idList []V) []V
- func ArrayUnset[V comparable](s []V, elems ...V) []V
- func ArrayValue[M ~map[K]V, K comparable, V any](m M, sort ...K) []V
- func CheckFreq(r *redis.Redis, optionList []FrequencyOption) (bool, error)
- func CheckTicket(r *redis.Redis, from string, biz string, ticket string) (bool, error)
- func Crc32(s string) uint32
- func ExtractUrlsFromHtml(content string) []string
- func FormatRelativeTime(showDate time.Time) string
- func GenRandomNumStr(n int) string
- func GenRandomStr(n int) string
- func GenUniqId(prefix string) string
- func GetCacheExpWithRand(t time.Duration) time.Duration
- func GetCacheKey(key string, args ...any) string
- func MapToUrlQueryString[V comparable](data map[string]V) string
- func Md5(s string) string
- func ParseTimeFromString(tm string) time.Time
- func SetFreq(r *redis.Redis, optionList []FrequencyOption) (bool, error)
- func SetOnceTicketKey(key string)
- func SetTicket(r *redis.Redis, from string, biz string, second int, ticket string) (string, error)
- func Sha256(s, salt string) string
- func SpanIDFromContext(ctx context.Context) string
- func StripSlashes(str string) string
- func StripTags(data string, allowedTags []string) string
- func Substr(str string, start int, length int) string
- func TraceIDFromContext(ctx context.Context) string
- func XorDecrypt(encryptedBase64 string, key string) (string, error)
- func XorEncrypt(input, key string) string
- type FrequencyOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayColumn ¶
func ArrayColumn[M ~[]map[K]V, K comparable, V any](m M, key K) []V
func ArrayDiff ¶
func ArrayDiff[V comparable](array1 []V, arrayOthers ...[]V) []V
func ArrayIn ¶
func ArrayIn[V comparable](needle V, haystack []V) bool
func ArrayIntersect ¶
func ArrayIntersect[V comparable](array1 []V, arrayOthers ...[]V) []V
func ArrayKey ¶
func ArrayKey[M ~map[K]V, K comparable, V any](m M) []K
func ArraySearch ¶
func ArraySearch[V comparable](needle V, haystack []V) int
func ArrayUnique ¶
func ArrayUnique[V comparable](idList []V) []V
func ArrayUnset ¶
func ArrayUnset[V comparable](s []V, elems ...V) []V
func ArrayValue ¶
func ArrayValue[M ~map[K]V, K comparable, V any](m M, sort ...K) []V
func CheckFreq ¶
func CheckFreq(r *redis.Redis, optionList []FrequencyOption) (bool, error)
CheckFreq 频次校验通用 业务校验使用 高并发不支持
func CheckTicket ¶
func ExtractUrlsFromHtml ¶
func FormatRelativeTime ¶
FormatRelativeTime 转换为相对时间
func GenRandomStr ¶
func GetCacheExpWithRand ¶
GetCacheExpWithRand 返回 t的时间 + [0- t的时间一半的时间)
func MapToUrlQueryString ¶
func MapToUrlQueryString[V comparable](data map[string]V) string
MapToUrlQueryString 将map格式数据拼接成url Get方式参数【注:拼接后的参数顺序是随机的】
func SetOnceTicketKey ¶
func SetOnceTicketKey(key string)
func SpanIDFromContext ¶
func TraceIDFromContext ¶
func XorDecrypt ¶
XorDecrypt XOR 使用给定密钥对Base64编码后的加密字符串进行解密
func XorEncrypt ¶
XorEncrypt XOR 对给定字符串使用给定密钥进行加密或解密,并返回Base64编码后的字符串
Types ¶
Click to show internal directories.
Click to hide internal directories.