Documentation ¶
Index ¶
- func DownImage(url, name, savePath string) (string, error)
- func MergeStructData(existing, newData interface{}) interface{}
- 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 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) 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) RandomId() string
- func (s *StrUtils) RegexpMatch(text string, pattern string) bool
- func (s *StrUtils) StrToInt64(intStr string) (int64, error)
- func (s *StrUtils) UUIDNoDash() string
- func (s *StrUtils) UniqueStrings(input []string) []string
- type StructUtils
- type TimeUtils
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeStructData ¶
func MergeStructData(existing, newData interface{}) interface{}
MergeStructData 使用反射来合并两个struct 反射影响高性能
Types ¶
type AesUtils ¶ added in v1.1.0
type AesUtils struct{}
func NewAesUtils ¶ added in v1.1.0
func NewAesUtils() *AesUtils
func (*AesUtils) EncryptAES ¶ added in v1.1.0
type ConsoleUtils ¶ added in v1.1.0
type ConsoleUtils struct{}
func NewConsoleUtils ¶ added in v1.1.0
func NewConsoleUtils() *ConsoleUtils
func (*ConsoleUtils) Black ¶ added in v1.1.0
func (c *ConsoleUtils) Black(txt string)
func (*ConsoleUtils) BlackBold ¶ added in v1.1.0
func (c *ConsoleUtils) BlackBold(txt string)
func (*ConsoleUtils) Green ¶ added in v1.1.0
func (c *ConsoleUtils) Green(txt string)
func (*ConsoleUtils) Red ¶ added in v1.1.0
func (c *ConsoleUtils) Red(txt string)
type CryptoUtils ¶ added in v1.1.0
type CryptoUtils struct{}
func NewCryptoUtils ¶ added in v1.1.0
func NewCryptoUtils() *CryptoUtils
type FFMpegUtils ¶ added in v1.1.0
type FFMpegUtils struct{}
func NewFFMpegUtils ¶ added in v1.1.0
func NewFFMpegUtils() *FFMpegUtils
func (*FFMpegUtils) ToHlsNonH264 ¶ added in v1.1.0
type FFProbeUtils ¶ added in v1.1.0
type FFProbeUtils struct{}
func NewFFProbeUtils ¶ added in v1.1.0
func NewFFProbeUtils() *FFProbeUtils
func (*FFProbeUtils) GetBitRates ¶ added in v1.1.0
func (f *FFProbeUtils) GetBitRates(filePath string) int
func (*FFProbeUtils) GetCodecNames ¶ added in v1.1.0
func (f *FFProbeUtils) GetCodecNames(filePath string) []string
func (*FFProbeUtils) GetDuration ¶ added in v1.1.0
func (f *FFProbeUtils) GetDuration(filePath string) int64
func (*FFProbeUtils) GetFormatName ¶ added in v1.1.0
func (f *FFProbeUtils) GetFormatName(filePath string) string
func (*FFProbeUtils) GetResolution ¶ added in v1.1.0
func (f *FFProbeUtils) GetResolution(filePath string) string
func (*FFProbeUtils) GetVideoDetails ¶ added in v1.1.0
func (f *FFProbeUtils) GetVideoDetails(filePath string) string
func (*FFProbeUtils) IsH264 ¶ added in v1.1.0
func (f *FFProbeUtils) IsH264(filePath string) bool
func (*FFProbeUtils) IsValidExt ¶ added in v1.1.0
func (f *FFProbeUtils) IsValidExt(filePath, ext string) bool
type GoogleTranslationUtils ¶ added in v1.1.0
type GoogleTranslationUtils struct{}
func NewGoogleTranslationUtils ¶ added in v1.1.0
func NewGoogleTranslationUtils() *GoogleTranslationUtils
func (*GoogleTranslationUtils) GoogleDetectLang ¶ added in v1.1.0
func (g *GoogleTranslationUtils) GoogleDetectLang(text string)
func (*GoogleTranslationUtils) GoogleTranslateToCN ¶ added in v1.1.0
func (g *GoogleTranslationUtils) GoogleTranslateToCN(text string, source string) (string, error)
func (*GoogleTranslationUtils) GoogleTranslateToEn ¶ added in v1.1.0
func (g *GoogleTranslationUtils) GoogleTranslateToEn(text string, source string) (string, error)
type HttpUtils ¶ added in v1.1.0
type HttpUtils struct{}
func NewHttpUtils ¶ added in v1.1.0
func NewHttpUtils() *HttpUtils
type JsonUtils ¶ added in v1.1.22
type JsonUtils struct{}
func NewJsonUtils ¶ added in v1.1.22
func NewJsonUtils() *JsonUtils
func (*JsonUtils) JSONPrettyFormat ¶ added in v1.1.22
func (*JsonUtils) ToJSONUnsafe ¶ added in v1.1.22
ToJSONUnsafe returns "{}" on failure case
type LangTranslatorUtils ¶ added in v1.1.0
type LangTranslatorUtils struct { T2s *opencc.OpenCC S2t *opencc.OpenCC // contains filtered or unexported fields }
func NewLangTranslatorUtils ¶ added in v1.1.0
func NewLangTranslatorUtils() *LangTranslatorUtils
func (*LangTranslatorUtils) Init ¶ added in v1.1.0
func (t *LangTranslatorUtils) Init()
type NumUtils ¶ added in v1.1.0
type NumUtils struct { }
func NewNumUtils ¶ added in v1.1.0
func NewNumUtils() *NumUtils
func (*NumUtils) CheckNumStrInRange ¶ added in v1.1.0
CheckNumStrInRange 检查一个字符串数字,大小是否在指定的范围内
func (*NumUtils) DecimalFormatBanker ¶ added in v1.1.0
DecimalFormatBanker 使用银行家舍入法格式化decimal类型值为两位小数
func (*NumUtils) FormatNumStrToDecimalAndShift ¶ added in v1.1.0
FormatNumStrToDecimalAndShift 输入1000,4 ,那么会输出 0.1
func (*NumUtils) HashIdToInt64 ¶ added in v1.1.0
func (*NumUtils) Int64ToHashId ¶ added in v1.1.0
func (*NumUtils) MergeToDecimal ¶ added in v1.1.0
MergeToDecimal 如果输入的number是100000,dec是10,那么:将100000的小数点向左移动10位,得到的结果是0.00001
type PwdUtils ¶ added in v1.1.11
type PwdUtils struct{}
func (*PwdUtils) GenerateSalt ¶ added in v1.1.11
GenerateSalt 生成一个随机盐值
func (*PwdUtils) HashPassword ¶ added in v1.1.11
HashPassword 使用 Argon2id 对密码进行加盐哈希
type ResultData ¶
type ResultData struct { Data struct { Translations []struct { TranslatedText string `json:"translatedText"` } `json:"translations"` } `json:"data"` }
type StrUtils ¶ added in v1.1.0
type StrUtils struct{}
func NewStrUtils ¶ added in v1.1.0
func NewStrUtils() *StrUtils
func (*StrUtils) FilterEmptyChar ¶ added in v1.1.0
func (*StrUtils) GenStrBySeed ¶ added in v1.1.11
GenStrBySeed 根据给定的字符串和种子生成一个可重现的新字符串(不建议用到密码)
func (*StrUtils) GetDirNameFromSnowflakeID ¶ added in v1.1.0
func (*StrUtils) IsAlphaNum ¶ added in v1.1.0
func (*StrUtils) NanoTimestampStr ¶ added in v1.1.0
func (*StrUtils) PadCnSpaceChar ¶ added in v1.1.0
PadCnSpaceChar 使用中文空格为字符串填充
func (*StrUtils) ProtoMessageToJson ¶ added in v1.1.0
func (*StrUtils) RegexpMatch ¶ added in v1.1.0
func (*StrUtils) StrToInt64 ¶ added in v1.1.0
func (*StrUtils) UUIDNoDash ¶ added in v1.1.0
func (*StrUtils) UniqueStrings ¶ added in v1.1.0
UniqueStrings 返回一个新的切片,其中包含原切片中的唯一字符串
type StructUtils ¶ added in v1.1.0
type StructUtils struct{}
func NewStructUtils ¶ added in v1.1.0
func NewStructUtils() *StructUtils
type TimeUtils ¶ added in v1.1.0
type TimeUtils struct{}
func NewTimeUtils ¶ added in v1.1.0
func NewTimeUtils() *TimeUtils
func (*TimeUtils) CompareTimeStrings ¶ added in v1.2.5
CompareTimeStrings 比较两个时间字符串,返回 -1, 0, 1 分别表示第一个时间小于、等于、大于第二个时间
func (*TimeUtils) SetTimezone ¶ added in v1.1.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.