Documentation
¶
Index ¶
- func CalcDaysFromYearMonth(year int, month int) int
- func CompareTime(t1, t2 time.Time) bool
- func ConvertToStringSlice(data []interface{}) []string
- func Decimal(value float64) float64
- func Decrypt(privateKeyFile, ciphertext string, types string) (plaintext string, err error)
- func DecryptOAEP(privateKeyFile, ciphertext string) (plaintext string, err error)
- func DecryptPKCS1v15(privateKeyFile, ciphertext string) (plaintext string, err error)
- func DeleteFile(name string) error
- func DirSize(dirname string) string
- func Encrypt(privateKeyFile, ciphertext string, types string) (plaintext string, err error)
- func EncryptOAEP(publicKeyFile string, content string) (ciphertext string, err error)
- func EncryptPKCS1v15(publicKeyFile string, content string) (ciphertext string, err error)
- func EncryptPassword(password, salt string) string
- func FileIsExisted(filename string) bool
- func FileSize(fileSize int64) string
- func FormatSize(size int64) string
- func GenerateKeyPair(bits int, privateKeyFile string, publicKeyFile string) (err error)
- func GetBetweenDates(sdate, edate string) []string
- func GetCityByIp(ip string) string
- func GetClientIp(ctx context.Context) string
- func GetCurrentDateString() string
- func GetDomain(ctx context.Context) string
- func GetHourBetweenDates(sdate, edate string) []string
- func GetHourDiffer(startTime, endTime string) float64
- func GetLocalIP() (string, error)
- func GetMin(a, b int64) int64
- func GetMinutesDiffer(startTime, endTime string) int
- func GetPublicIP() (ip string, err error)
- func GetQuarterDay() (string, string)
- func GetTime(i int, types int, begin string) (startTime string, endTime string, duration int, unit string)
- func GetTimeByInt(t1 int64) time.Time
- func GetTimeByType(types int) (index int, begin string, end string)
- func GetTimeMills(t time.Time) int64
- func GetTimeTagGroup() string
- func GetTimeUnix(t time.Time) int64
- func GetUserAgent(ctx context.Context) string
- func GetWeekDay() (string, string)
- func InArray(target string, strArray []string) bool
- func IpInBlackListRange(ip string, ipList []string) (result bool)
- func IsSameDay(t1, t2 int64) bool
- func IsSameMinute(t1, t2 int64) bool
- func ParseFilePath(pathStr string) (fileName string, fileType string)
- func ParseIpRange(cidr string) ([]string, error)
- func ParsePrivateKeyFromPEM(pemBytes []byte) (privateKey *rsa.PrivateKey, err error)
- func ParsePublicKeyFromPEM(pemBytes []byte) (publicKey *rsa.PublicKey, err error)
- func ReadBlock(filePath string)
- func ReadZipFileByFileName(file *ghttp.UploadFile, fileName string) (result map[string]interface{}, err error)
- func RemoveDuplicationMap(arr []string) []string
- func RemoveRepeatedElementAndEmpty(arr []int) []int
- func ReplaceTemplate(content string, variable map[string]interface{}) (result string, err error)
- func ReverseRead(name string, lineNum uint) ([]string, error)
- func ReverseReadLines(name string) ([]string, error)
- func SavePrivateKeyToFile(privateKey *rsa.PrivateKey, filename string) (err error)
- func SavePublicKeyToFile(publicKey *rsa.PublicKey, filename string) (err error)
- func ShouldExclude(filename string, excludeList []string) bool
- func UploadZip(file *ghttp.UploadFile, zipPath string, excludeFiles []string) (err error)
- func ValidatePassword(password string, minimumLength int, requireComplexity int, requireDigit int, ...) (flag bool, err error)
- func WalkDir(dirname string) ([]fileInfo, error)
- func WriteToFile(fileName string, content string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcDaysFromYearMonth ¶
CalcDaysFromYearMonth 返回给定年份和月份的天数
func ConvertToStringSlice ¶
func ConvertToStringSlice(data []interface{}) []string
func DecryptOAEP ¶
DecryptOAEP 使用私钥解密数据
func DecryptPKCS1v15 ¶
DecryptPKCS1v15 使用私钥解密数据
func EncryptOAEP ¶
EncryptOAEP 使用公钥加密数据
func EncryptPKCS1v15 ¶
EncryptPKCS1v15 使用公钥加密数据
func GenerateKeyPair ¶
GenerateKeyPair 生成RSA密钥对
func GetBetweenDates ¶
GetBetweenDates 根据开始日期和结束日期计算出时间段内所有日期 参数为日期格式,如:2020-01-01
func GetHourBetweenDates ¶
func GetHourDiffer ¶
GetHourDiffer 计算俩个时间差多少小时
func GetMinutesDiffer ¶
GetMinutesDiffer 计算俩个时间差多少分钟
func GetTime ¶
func GetTime(i int, types int, begin string) (startTime string, endTime string, duration int, unit string)
GetTime 根据类型和开始时间获取时间段及长度
func GetTimeByType ¶
GetTimeByType 根据类型获取开始时间、结束时间及差值 1 天 2 周 3 月 4 年
func IpInBlackListRange ¶
IpInBlackListRange 判断IP是否在黑名单
func ParseFilePath ¶
ParseFilePath 解析路径获取文件名称及后缀
func ParseIpRange ¶
ParseIpRange 用于将以 "," 分割的多个 CIDR 范围字符串解析为 CIDR 数组。 如果一个 CIDR 范围是以 "-" 分割的两个 IP 地址,那么我们会使用 binaryToInt 和 intToIP 函数将它们转换为整数并再次转换为 CIDR 字符串, 并将其加入到 CIDR 数组中。
func ParsePrivateKeyFromPEM ¶
func ParsePrivateKeyFromPEM(pemBytes []byte) (privateKey *rsa.PrivateKey, err error)
ParsePrivateKeyFromPEM 从 PEM 格式的字节切片中解析 RSA 私钥
func ParsePublicKeyFromPEM ¶
ParsePublicKeyFromPEM 从 PEM 格式的字节切片中解析 RSA 公钥
func ReadZipFileByFileName ¶
func ReadZipFileByFileName(file *ghttp.UploadFile, fileName string) (result map[string]interface{}, err error)
ReadZipFileByFileName 读取压缩包指定文件内容
func RemoveDuplicationMap ¶
RemoveDuplicationMap 数组去重
func ReplaceTemplate ¶
func ReverseReadLines ¶
ReverseReadLines 从文件末尾开始逆序高效地读取行。
func SavePrivateKeyToFile ¶
func SavePrivateKeyToFile(privateKey *rsa.PrivateKey, filename string) (err error)
SavePrivateKeyToFile 将 RSA 私钥保存到文件
func SavePublicKeyToFile ¶
SavePublicKeyToFile 将 RSA 公钥保存到文件
func ShouldExclude ¶
func UploadZip ¶
func UploadZip(file *ghttp.UploadFile, zipPath string, excludeFiles []string) (err error)
UploadZip 上传ZIP包
func ValidatePassword ¶
Types ¶
This section is empty.