util

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir added in v0.3.0

func CacheDir() string

CacheDir return cache dir path string

func Chunk added in v0.5.1

func Chunk[T any](s iter.Seq2[T, error], n int) iter.Seq2[[]T, error]

Chunk chunks the sequence into n-sized chunks Note: slices.Chunk doesn't support iterators as of Go 1.23. https://pkg.go.dev/slices#Chunk

func FetchConcurrently

func FetchConcurrently(urls []string, concurrency, wait int) (responses [][]byte, err error)

FetchConcurrently fetches concurrently

func FetchURL

func FetchURL(fetchURL string) (*http.Response, error)

FetchURL returns HTTP response

func GenWorkers

func GenWorkers(num, wait int) chan<- func()

GenWorkers generate workers

func GetDefaultLogDir

func GetDefaultLogDir() string

GetDefaultLogDir returns default log directory

func Major

func Major(osVer string) (majorVersion string)

Major returns major version

func SetLogger

func SetLogger(logToFile bool, logDir string, debug, logJSON bool) error

SetLogger set logger

func TrimSpaceNewline

func TrimSpaceNewline(str string) string

TrimSpaceNewline deletes space character and newline character(CR/LF)

func Unique added in v0.4.2

func Unique[T comparable](s []T) []T

Unique return unique elements

Types

This section is empty.

Jump to

Keyboard shortcuts

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