Versions in this module Expand all Collapse all v3 v3.0.0 Nov 7, 2023 Changes in this version + func CloseIO(c io.Closer) + func Contains(arr []E, elem E) bool + func ConvertMap(m map[K]V, fn func(K, V) T) []T + func ConvertSlice(sli []E, fn func(E) T) []T + func ConvertSliceToMap(sli []E, fn func(E) (K, V)) map[K]V + func CopyFile(src, dest string) error + func DistinctSlice(sli []E) []E + func DropSliceZero(sli []E) []E + func FilterMap(m map[K]V, fn func(K, V) bool) map[K]V + func FilterSlice(sli []E, fn func(E) bool) []E + func ForeachSlice(sli []E, fn func(E)) + func GCD(x, y int) int + func IPv4ToNum(ip string) uint32 + func IPv4ToStr(ip uint32) string + func IsIPv4(s string) bool + func IsIPv6(s string) bool + func IsIntranet(ipv4 string) bool + func IsMAC(s string) bool + func ListenChan(chans ...<-chan T) (ch <-chan T) + func Max(x ...T) T + func Min(x ...T) T + func NewMultiReadCloserToReader(ctx context.Context, rc ...io.ReadCloser) (r io.Reader, add func(rc io.ReadCloser) error, endAdd func()) + func NewMultiReadCloserToWriter(ctx context.Context, writer func(order int, p []byte)) (send func(readSize, order int, reader io.ReadCloser), wait func() error) + func NewPipelineRunner(ctx context.Context, steps ...func(context.Context, T) bool) (push func(T) bool, successCh <-chan T, endPush func()) + func NewRunner(ctx context.Context, max int, fn func(context.Context, T) error) (run func(t T, block bool) error, wait func(fastExit bool) error) + func PickMapKey(m map[K]V) []K + func PickMapValue(m map[K]V) []V + func RandomChars(length int) string + func RandomCharsCaseInsensitive(length int) string + func RandomString(length int, chars string) string + func RunCommandAndPrompt(cmd string, prompts ...string) (stdout, stderr []byte, err error) + func RunConcurrently(ctx context.Context, fn ...func(context.Context) error) (wait func(fastExit bool) error) + func RunData(ctx context.Context, fn func(context.Context, T) error, fastExit bool, ...) error + func RunPeriodically(period time.Duration) (run func(fn func())) + func RunPipeline(ctx context.Context, jobs []T, stopWhenErr bool, ...) (successCh <-chan T, errCh <-chan error) + func RunSequentially(ctx context.Context, fn ...func(context.Context) error) error + func StackTrace() string + func UUIDLike() string + func UnzipFromBytes(zippedBytes []byte, toDir string) (filePaths []string, err error) + func UnzipFromFiles(zippedFilePath string, toDir string) (filePaths []string, err error) + func ZipFiles(toZippedFilePath string, fromDir string) error + func ZipFilesToBytes(filePaths ...string) ([]byte, error) + type AxisMarker struct + func (m *AxisMarker) GetMaxMarkLine(begin int64) int64 + func (m *AxisMarker) Mark(offset, length int64) + func (m *AxisMarker) String() string + type Command struct + func RunCommand(cmd string) *Command + func (c *Command) IsExit() bool + func (c *Command) Out() (stdout, stderr []byte, err error) + func (c *Command) Read() []byte + func (c *Command) Write(input string) error + type FairLocker struct + func (locker *FairLocker) RLock() + func (locker *FairLocker) RUnlock() + func (locker *FairLocker) WLock() + func (locker *FairLocker) WUnlock() + type Number interface + type Queue struct + func (q *Queue[E]) Close() + func (q *Queue[E]) GetFromChan() <-chan E + func (q *Queue[E]) Push(elem E) bool + type ReadFirstLocker struct + func (locker *ReadFirstLocker) RLock() + func (locker *ReadFirstLocker) RUnlock() + func (locker *ReadFirstLocker) WLock() + func (locker *ReadFirstLocker) WUnlock() + type WriteAtCloser interface + CloseByError func(error) error + func NewWriteAtReader() (WriteAtCloser, io.ReadCloser) + type WriteFirstLocker struct + func (locker *WriteFirstLocker) RLock() + func (locker *WriteFirstLocker) RUnlock() + func (locker *WriteFirstLocker) WLock() + func (locker *WriteFirstLocker) WUnlock() Other modules containing this package gitee.com/ivfzhou/gotools gitee.com/ivfzhou/gotools/v2 gitee.com/ivfzhou/gotools/v4