Documentation
¶
Index ¶
- func AutoConvert(s string) interface{}
- func BackupPath(src string) string
- func CheckIfFileExistsIgnoringExt(dir, filenameWithoutExt string) (bool, error)
- func ContainsInSlice[T any](slice []T, elem T) bool
- func ExecuteCommandToFile(command string, outputFilePath string, args ...string) error
- func ExecuteCommandToNull(command string, dirPath string, args ...string) error
- func ExtractExecutable(archivePath, dir string) string
- func ExtractLastPathSegment(inputURL string) string
- func GetBody(body io.Reader) string
- func GetCurrentExecutablePath() string
- func GetEnv(key string) string
- func GetFilenameWithoutExt(path string) string
- func GetResourceFromPageNum[T any](pageNum, numPerPage int, data []T) []T
- func HttpGet(url string) string
- func HttpGetDownload(url string, dir string, name string) string
- func HttpGetDownloadWithProgress(url string, dir string, name string) string
- func HttpPost(url string, contentType string, body io.Reader) string
- func IsRegularFile(path string) bool
- func JsonDump(value interface{}) string
- func JsonLoad(date []byte) interface{}
- func NewHTTPClientWithHTTPProxy() *http.Client
- func NewHTTPClientWithSocket5Proxy() *http.Client
- func Paginate[T any](data []T, pageSize int) map[int][]T
- func PrintSliceAsTable[T any](title string, data []T)
- func RemoveHTMLTags(html string) string
- func SortByField[T any](data []T, fieldName string)
- func StripExt(filename string) string
- type BarTask
- type Cache
- type GoroutinePool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoConvert ¶
func AutoConvert(s string) interface{}
func BackupPath ¶
func CheckIfFileExistsIgnoringExt ¶
CheckIfFileExistsIgnoringExt 检查指定目录下是否存在给定名称的文件,忽略文件扩展名。
func ContainsInSlice ¶
func ExecuteCommandToFile ¶
func ExecuteCommandToNull ¶
func ExtractExecutable ¶
func ExtractLastPathSegment ¶
func GetCurrentExecutablePath ¶
func GetCurrentExecutablePath() string
func GetFilenameWithoutExt ¶
func GetResourceFromPageNum ¶
func HttpGetDownloadWithProgress ¶
HttpGetDownloadWithProgress 下载文件到指定目录,支持进度条
func IsRegularFile ¶
func NewHTTPClientWithHTTPProxy ¶
NewHTTPClientWithHTTPProxy 创建一个使用 HTTP/HTTPS 代理的 http.Client proxyURLStr 格式示例:
func PrintSliceAsTable ¶
PrintSliceAsTable 打印结构体数组为表格形式
func RemoveHTMLTags ¶
func SortByField ¶
Types ¶
type BarTask ¶
type BarTask struct {
MaxWorker int
PrintLineNum int
TaskStatusArray []*taskStatus
Refresh time.Duration
// contains filtered or unexported fields
}
func NewBarTask ¶
type GoroutinePool ¶
type GoroutinePool struct {
// contains filtered or unexported fields
}
func NewGoroutinePool ¶
func NewGoroutinePool(maxWorkers int, expiryDuration time.Duration) (*GoroutinePool, error)
NewGoroutinePool 创建一个新的GoroutinePool实例
func (*GoroutinePool) Submit ¶
func (gp *GoroutinePool) Submit(task func()) error
Submit 提交一个任务到池中,并增加WaitGroup计数
Click to show internal directories.
Click to hide internal directories.