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 GetBotID(token string) int64
- func GetBotToken(content string) (string, bool)
- 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 NiceNumber(num any) string
- func Number2Icon(number int) string
- 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 ToFloat64[T ConvertibleToFloat64](v T) float64
- func ToInt64[T ConvertibleToInt64](v T) int64
- func ToObjectID[T ConvertibleToObjectID](v T) primitive.ObjectID
- func ToString[T ConvertibleToString](v T) string
- func TrimLastZero(f float64, p ...string) string
- func UTF8DecodeRune(text string) []string
- func ValueInSlice[T comparable](v T, slice []T) bool
- type ConvertibleToFloat64
- type ConvertibleToInt64
- type ConvertibleToObjectID
- type ConvertibleToString
- type EqualsConstraint
- type JSONBody
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 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 ToFloat64 ¶
func ToFloat64[T ConvertibleToFloat64](v T) float64
ToFloat64 泛型函数,尝试将不同的类型转换为float64。
func ToObjectID ¶
func ToObjectID[T ConvertibleToObjectID](v T) primitive.ObjectID
ToObjectID 泛型函数,尝试将不同的类型转换为ObjectID。
func ValueInSlice ¶
func ValueInSlice[T comparable](v T, slice []T) bool
ValueInSlice 函数检查值v是否存在于切片slice中。 这里使用了泛型,允许对任意可比较的类型进行操作。
Types ¶
type ConvertibleToFloat64 ¶
ConvertibleToFloat64 是一个约束,它匹配所有可以转换为float64的类型。
type ConvertibleToInt64 ¶
ConvertibleToInt64 是一个约束,它匹配所有可以转换为int64的类型。
type ConvertibleToObjectID ¶
ConvertibleToObjectID 是一个约束,它匹配所有可以转换为ObjectID的类型。
type ConvertibleToString ¶
ConvertibleToString 是一个约束,它匹配所有可以转换为string的类型。
type EqualsConstraint ¶
type EqualsConstraint[T comparable] interface { }
EqualsConstraint 约束指定了类型T必须能够与自己进行等值比较。