Documentation ¶
Index ¶
- func DownImage(url, name, savePath string) (string, error)
- type AesUtils
- type ConsoleUtils
- type CryptoUtils
- type FFMpegUtils
- type FFProbeUtils
- func (f *FFProbeUtils) GetBitRates(filePath string) int
- func (f *FFProbeUtils) GetCodecNames(filePath string) []string
- func (f *FFProbeUtils) GetDuration(filePath string) int64
- func (f *FFProbeUtils) GetFormatName(filePath string) string
- func (f *FFProbeUtils) GetResolution(filePath string) string
- func (f *FFProbeUtils) GetVideoDetails(filePath string) string
- func (f *FFProbeUtils) IsH264(filePath string) bool
- func (f *FFProbeUtils) IsValidExt(filePath, ext string) bool
- type GoogleTranslationUtils
- type HttpUtils
- type JsonUtils
- type LangTranslatorUtils
- type NetUtils
- type NumUtils
- func (n *NumUtils) CheckNumStrInRange(s string, min float64, max float64) (bool, error)
- func (n *NumUtils) DecimalFormatBanker(value decimal.Decimal) string
- func (n *NumUtils) FormatNumStrToDecimalAndShift(number string, decimals uint) decimal.Decimal
- func (n *NumUtils) GetMaxNum(vals ...int) int
- func (n *NumUtils) HashIdToInt64(id string, minLen uint8) (int64, error)
- func (n *NumUtils) Int64ToHashId(number int64, minLen uint8) string
- func (n *NumUtils) MergeToDecimal(number *big.Int, dec int) decimal.Decimal
- func (n *NumUtils) RandomInt(min, max int) int
- func (n *NumUtils) StrToDecimalTruncate(s string, precision int32) decimal.Decimal
- type PwdUtils
- func (p *PwdUtils) Decrypt(ciphertext, key string) (string, error)
- func (p *PwdUtils) Encrypt(plaintext, key string) (string, error)
- func (p *PwdUtils) GenerateSalt() (string, error)
- func (p *PwdUtils) HashPassword(password, salt string) (string, error)
- func (p *PwdUtils) VerifyPassword(password, salt, hash string) (bool, error)
- type ResultData
- type StrUtils
- func (s *StrUtils) Calculator(exp string) (string, error)
- func (s *StrUtils) FilterEmptyChar(str string) string
- func (s *StrUtils) GenSha1(input string) string
- func (s *StrUtils) GenStrBySeed(input, seed string) string
- func (s *StrUtils) GetDirNameFromSnowflakeID(snowflakeID int64) string
- func (s *StrUtils) IsAlphaNum(str string) bool
- func (s *StrUtils) Length(str string) int
- func (s *StrUtils) Md5(str string) string
- func (s *StrUtils) NanoTimestampStr() string
- func (s *StrUtils) PadCnSpaceChar(label string, spaces int) string
- func (s *StrUtils) ProtoMessageToJson(msg proto.Message) (string, error)
- func (s *StrUtils) RegexpMatch(text string, pattern string) bool
- func (s *StrUtils) StrToInt64(intStr string) (int64, error)
- func (s *StrUtils) StringToNumber(str string) uint32
- func (s *StrUtils) UniqueStrings(input []string) []string
- type StructUtils
- type TimeUtils
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AesUtils ¶
type AesUtils struct{}
func NewAesUtils ¶
func NewAesUtils() *AesUtils
func (*AesUtils) EncryptAES ¶
type ConsoleUtils ¶
type ConsoleUtils struct{}
func NewConsoleUtils ¶
func NewConsoleUtils() *ConsoleUtils
func (*ConsoleUtils) Black ¶
func (c *ConsoleUtils) Black(txt string)
func (*ConsoleUtils) BlackBold ¶
func (c *ConsoleUtils) BlackBold(txt string)
func (*ConsoleUtils) Green ¶
func (c *ConsoleUtils) Green(txt string)
func (*ConsoleUtils) Red ¶
func (c *ConsoleUtils) Red(txt string)
type CryptoUtils ¶
type CryptoUtils struct{}
func NewCryptoUtils ¶
func NewCryptoUtils() *CryptoUtils
type FFMpegUtils ¶
type FFMpegUtils struct{}
func NewFFMpegUtils ¶
func NewFFMpegUtils() *FFMpegUtils
func (*FFMpegUtils) ToHlsNonH264 ¶
type FFProbeUtils ¶
type FFProbeUtils struct{}
func NewFFProbeUtils ¶
func NewFFProbeUtils() *FFProbeUtils
func (*FFProbeUtils) GetBitRates ¶
func (f *FFProbeUtils) GetBitRates(filePath string) int
func (*FFProbeUtils) GetCodecNames ¶
func (f *FFProbeUtils) GetCodecNames(filePath string) []string
func (*FFProbeUtils) GetDuration ¶
func (f *FFProbeUtils) GetDuration(filePath string) int64
func (*FFProbeUtils) GetFormatName ¶
func (f *FFProbeUtils) GetFormatName(filePath string) string
func (*FFProbeUtils) GetResolution ¶
func (f *FFProbeUtils) GetResolution(filePath string) string
func (*FFProbeUtils) GetVideoDetails ¶
func (f *FFProbeUtils) GetVideoDetails(filePath string) string
func (*FFProbeUtils) IsH264 ¶
func (f *FFProbeUtils) IsH264(filePath string) bool
func (*FFProbeUtils) IsValidExt ¶
func (f *FFProbeUtils) IsValidExt(filePath, ext string) bool
type GoogleTranslationUtils ¶
type GoogleTranslationUtils struct{}
func NewGoogleTranslationUtils ¶
func NewGoogleTranslationUtils() *GoogleTranslationUtils
func (*GoogleTranslationUtils) GoogleDetectLang ¶
func (g *GoogleTranslationUtils) GoogleDetectLang(text string)
func (*GoogleTranslationUtils) GoogleTranslateToCN ¶
func (g *GoogleTranslationUtils) GoogleTranslateToCN(text string, source string) (string, error)
func (*GoogleTranslationUtils) GoogleTranslateToEn ¶
func (g *GoogleTranslationUtils) GoogleTranslateToEn(text string, source string) (string, error)
type JsonUtils ¶
type JsonUtils struct{}
func NewJsonUtils ¶
func NewJsonUtils() *JsonUtils
func (*JsonUtils) JSONPrettyFormat ¶
func (*JsonUtils) ToJSONUnsafe ¶
ToJSONUnsafe returns "{}" on failure case
type LangTranslatorUtils ¶
type LangTranslatorUtils struct { T2s *opencc.OpenCC S2t *opencc.OpenCC // contains filtered or unexported fields }
func NewLangTranslatorUtils ¶
func NewLangTranslatorUtils() *LangTranslatorUtils
func (*LangTranslatorUtils) Init ¶
func (t *LangTranslatorUtils) Init()
type NetUtils ¶
type NetUtils struct{}
func NewNetUtils ¶
func NewNetUtils() *NetUtils
func (*NetUtils) GetLocalIP ¶
type NumUtils ¶
type NumUtils struct { }
func NewNumUtils ¶
func NewNumUtils() *NumUtils
func (*NumUtils) CheckNumStrInRange ¶
CheckNumStrInRange 检查一个字符串数字,大小是否在指定的范围内
func (*NumUtils) DecimalFormatBanker ¶
DecimalFormatBanker 使用银行家舍入法格式化decimal类型值为两位小数
func (*NumUtils) FormatNumStrToDecimalAndShift ¶
FormatNumStrToDecimalAndShift 输入1000,4 ,那么会输出 0.1
func (*NumUtils) HashIdToInt64 ¶
func (*NumUtils) Int64ToHashId ¶
func (*NumUtils) MergeToDecimal ¶
MergeToDecimal 如果输入的number是100000,dec是10,那么:将100000的小数点向左移动10位,得到的结果是0.00001
type PwdUtils ¶
type PwdUtils struct{}
func (*PwdUtils) GenerateSalt ¶
GenerateSalt 生成一个随机盐值
func (*PwdUtils) HashPassword ¶
HashPassword 使用 Argon2id 对密码进行加盐哈希
type ResultData ¶
type ResultData struct { Data struct { Translations []struct { TranslatedText string `json:"translatedText"` } `json:"translations"` } `json:"data"` }
type StrUtils ¶
type StrUtils struct{}
func NewStrUtils ¶
func NewStrUtils() *StrUtils
func (*StrUtils) Calculator ¶
Calculator 输入字符串数学表达式,将计算出结果
func (*StrUtils) FilterEmptyChar ¶
func (*StrUtils) GenStrBySeed ¶
GenStrBySeed 根据给定的字符串和种子生成一个可重现的新字符串(不建议用到密码)
func (*StrUtils) GetDirNameFromSnowflakeID ¶
func (*StrUtils) IsAlphaNum ¶
func (*StrUtils) NanoTimestampStr ¶
func (*StrUtils) PadCnSpaceChar ¶
PadCnSpaceChar 使用中文空格为字符串填充
func (*StrUtils) ProtoMessageToJson ¶
func (*StrUtils) StringToNumber ¶
func (*StrUtils) UniqueStrings ¶
UniqueStrings 返回一个新的切片,其中包含原切片中的唯一字符串
type StructUtils ¶
type StructUtils struct{}
func NewStructUtils ¶
func NewStructUtils() *StructUtils
func (*StructUtils) MergeStructData ¶
func (s *StructUtils) MergeStructData(existing, newData interface{}) interface{}
MergeStructData 使用反射来合并两个struct 反射影响高性能
func (*StructUtils) StructToMap ¶
func (s *StructUtils) StructToMap(configStruct interface{}) (map[string]interface{}, error)
StructToMap 将结构体转换为 map
type TimeUtils ¶
type TimeUtils struct{}
func NewTimeUtils ¶
func NewTimeUtils() *TimeUtils
func (*TimeUtils) CompareTimeStrings ¶
CompareTimeStrings 比较两个时间字符串,返回 -1, 0, 1 分别表示第一个时间小于、等于、大于第二个时间
func (*TimeUtils) SetTimezone ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.