utils

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(ss []string, s string) bool

ContainsString 检测字符串是否在字符串数组里

func ConvertTime

func ConvertTime(t time.Duration) string

func ConvertTimeSecond added in v0.1.3

func ConvertTimeSecond(seconds int64) string

func DecompressGZIP

func DecompressGZIP(r io.Reader) ([]byte, error)

DecompressGZIP 对 io.Reader 数据, 进行 gzip 解压

func FlagProvided

func FlagProvided(names ...string) bool

FlagProvided 检测命令行是否提供名为 name 的 flag, 支持多个name(names)

func GetURLCookieString

func GetURLCookieString(urlString string, jar *cookiejar.Jar) string

GetURLCookieString 返回cookie字串

func GetUniqueKeyStr added in v0.1.6

func GetUniqueKeyStr() string

GetUniqueKeyStr 获取本机唯一标识

func HasPrefix added in v0.1.1

func HasPrefix(s, prefix string) bool

HasPrefix 判断是否以某字符串作为开始

func HasSuffix added in v0.1.1

func HasSuffix(s, suffix string) bool

HasSuffix 判断是否以某字符串作为结尾

func IsExcludeFile added in v0.2.4

func IsExcludeFile(filePath string, excludeNames *[]string) bool

IsExcludeFile 是否是指定排除的文件

func IsLocalAbsPath added in v0.2.2

func IsLocalAbsPath(filePath string) bool

IsLocalAbsPath 是否是本地绝对路径

func IsPanAbsPath added in v0.2.2

func IsPanAbsPath(filePath string) bool

IsPanAbsPath 是否是云盘绝对路径

func Md5Str added in v0.1.6

func Md5Str(text string) string

Md5Str MD5哈希计算

func NowTimeStr added in v0.1.6

func NowTimeStr() string

NowTimeStr 当前时间字符串,格式为:2006-01-02 15:04:05

func ObjectToJsonStr added in v0.1.6

func ObjectToJsonStr(v interface{}, useIndent bool) string

ObjectToJsonStr 转换成json字符串

func ParseTimeStr added in v0.1.6

func ParseTimeStr(value string) time.Time

ParseTimeStr 反解析时间字符串

func ParseVersionNum

func ParseVersionNum(versionStr string) int

func PathExists added in v0.1.6

func PathExists(path string) (bool, error)

PathExists 文件路径是否存在

func ResizeUploadBlockSize added in v0.2.5

func ResizeUploadBlockSize(fileSize, defaultBlockSize int64) int64

ResizeUploadBlockSize 自动调整分片大小,方便支持极大单文件上传。返回新的分片大小

func Trigger

func Trigger(f func())

Trigger 用于触发事件

func TriggerOnSync

func TriggerOnSync(f func())

TriggerOnSync 用于触发事件, 同步触发

func TrimPathPrefix

func TrimPathPrefix(path, prefixPath string) string

TrimPathPrefix 去除目录的前缀

func UuidStr added in v0.1.6

func UuidStr() string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL