Documentation ¶
Index ¶
- func Abs(n int64) int64
- func Base64Decode(content string) string
- func Base64Encode(content string) string
- func CleanNewline(s string) string
- func CleanSpecialSymbols(s string) string
- func ClearHTML(s string) string
- func ClearSpace(s string) string
- func ClearTGLink(link string) string
- func CompleteBase64URLSafe(s string) string
- func Config(key string) string
- func DetectGenderFromDict(name string) (string, error)
- func DetermineGender(name string) string
- func EnsureOwner(address, message, signature string) (common.Address, error)
- func EscapeHTML(content string) string
- func FindSubstr(content string, params ...any) string
- func FormatURL(base string, html string) string
- func GetBotID(token string) int64
- func GetBotToken(content string) (string, bool)
- func GetLanguageCode(countryCode string) string
- func GetLinks(s string) []string
- func HMAC(h func() hash.Hash, payload []byte, secret []byte) []byte
- func HiddenBotToken(s string) string
- func IsBotToken(token string) bool
- func IsCommand(text string) bool
- func IsEnglish(str string) bool
- func IsObjectID(v string) bool
- func IsURL(token string) bool
- func MD5(text string) string
- func MergeStructs(dst, src interface{})
- func NiceNumber(num any) string
- func Number2Icon(number int) string
- func ParseHumanNum(s string) int64
- func RandDoubleAverage(count int64, min float64, max float64) float64
- func RandFloatRange(min float64, max float64) float64
- func RandRange(min int, max int) int
- func RandString(n int) string
- func RunesToHexKey(runes []rune) string
- func Sha1(text string) string
- func SignHash(data []byte) []byte
- func Split2Tags(text string) []string
- func StrLen(text string) int
- func StrLimit(text string, length int) string
- func StringToHexKey(input string) string
- func TimestampToTime(msTimestamp int64) time.Time
- func ToBool[T Convertible](v T) bool
- func ToFNV32Hash[T Convertible](v T) uint32
- func ToFNV64Hash[T Convertible](v T) uint64
- func ToFloat64[T Convertible](v T) float64
- func ToInt32[T Convertible](v T) int32
- func ToInt64[T Convertible](v T) int64
- func ToObjectID[T Convertible](v T) primitive.ObjectID
- func ToString[T Convertible](v T) string
- func ToUInt32[T Convertible](v T) uint32
- func ToUInt64[T Convertible](v T) uint64
- func TrimLastZero(f float64, p ...string) string
- func UTF8DecodeRune(text string) []string
- func ValueInSlice[T comparable](v T, slice []T) bool
- type Convertible
- type EqualsConstraint
- type JSONBody
- type Zeroer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompleteBase64URLSafe ¶
CompleteBase64URLSafe adjusts a Base64 URL-safe encoded string by replacing '-' with '+', '_' with '/', and adding missing padding '=' characters
func DetectGenderFromDict ¶
DetectGenderFromDict
func EnsureOwner ¶ added in v0.1.1
EnsureOwner verifies that the signature corresponds to the given address.
func GetBotToken ¶
GetBotToken is get bot token for content
func GetLanguageCode ¶ added in v0.1.41
GetLanguageCode 获取国家代码对应的主要语言代码
func MergeStructs ¶ added in v0.1.43
func MergeStructs(dst, src interface{})
MergeStructs 将 src 结构体的非零值字段合并到 dst 结构体中
func ParseHumanNum ¶ added in v0.1.49
ParseHumanNum 将人类可读的数字格式(如 "10k"、"10M")转换为实际的整数 如果无法解析,则返回0
func RandDoubleAverage ¶
RandDoubleAverage 二倍均值算法生成随机数
func RunesToHexKey ¶
RunesToHexKey - Convert a slice of runes to hex string representation of their Unicode Code Point value
func StringToHexKey ¶
StringToHexKey - Convert a string to hex string representation of their Unicode Code Point value
func TimestampToTime ¶ added in v0.1.2
TimestampToTime 将毫秒级时间戳转换为time.Time类型
func ToFNV32Hash ¶ added in v0.1.48
func ToFNV32Hash[T Convertible](v T) uint32
ToFNV32Hash 泛型函数,使用 FNV-1a 算法将输入转换为 32 位哈希值。
func ToFNV64Hash ¶ added in v0.1.48
func ToFNV64Hash[T Convertible](v T) uint64
ToFNV64Hash 泛型函数,使用 FNV-1a 算法将输入转换为 64 位哈希值。
func ToObjectID ¶
func ToObjectID[T Convertible](v T) primitive.ObjectID
ToObjectID 泛型函数,尝试将不同的类型转换为ObjectID。
func ToUInt32 ¶ added in v0.1.34
func ToUInt32[T Convertible](v T) uint32
ToUInt32 泛型函数,尝试将不同的类型转换为uint32。
func ToUInt64 ¶ added in v0.1.48
func ToUInt64[T Convertible](v T) uint64
ToUInt64 泛型函数,尝试将不同的类型转换为uint64。
func ValueInSlice ¶
func ValueInSlice[T comparable](v T, slice []T) bool
ValueInSlice 函数检查值v是否存在于切片slice中。 这里使用了泛型,允许对任意可比较的类型进行操作。
Types ¶
type Convertible ¶ added in v0.1.48
type Convertible interface { ~string | ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~bool | primitive.ObjectID }
定义一个通用的类型约束
type EqualsConstraint ¶
type EqualsConstraint[T comparable] interface { }
EqualsConstraint 约束指定了类型T必须能够与自己进行等值比较。