rtool

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareDifferenceVMap added in v0.0.9

func CompareDifferenceVMap[T IntUintStringByte](src []T, tar []T) []T

CompareDifferenceVMap 切片差集Map版,如需节约内存,使用Range版,返回tar与src的差集,返回内容为src的元素。

func CompareDifferenceVRange added in v0.0.9

func CompareDifferenceVRange[T IntUintStringByte](src []T, tar []T) []T

CompareDifferenceVRange 切片差集Range版,如需速度更快,使用Map版,返回tar与src的差集,返回内容为src的元素。 注意,src和tar不宜过多。

func CompareUnionVMap added in v0.0.9

func CompareUnionVMap[T IntUintStringByte](src []T, tar []T) []T

CompareUnionVMap 切片并集Map版,如需节约内存,使用Range版,返回tar与src的并集

func CompareUnionVRange added in v0.0.9

func CompareUnionVRange[T IntUintStringByte](src []T, tar []T) []T

CompareUnionVRange 切片并集Range版,如需速度更快,使用Map版,返回tar与src的并集 注意,src和tar不宜过多。

func CutSplitByIndex added in v0.0.9

func CutSplitByIndex[T IntUintStringByteFloat](src []T, start int, end int) []T

CutSplitByIndex 截取切片,根据指定的开始下标和结束下标 src:切片源 start:开始下标,第一个为0 end:结束位置,注意不包含结束的下标元素

func CutSplitByPage added in v0.0.9

func CutSplitByPage[T IntUintStringByteFloat](src []T, page int, size int) []T

CutSplitByPage 截取切片,根据指定的页码和大小 src:切片源 page:页码,从0开始为第1页 size:页大小

func CutStringByIndex added in v0.0.9

func CutStringByIndex(src string, start int, end int) string

CutStringByIndex 截取字符串,根据指定的开始下标和结束下标 src:切片源 start:开始下标,第一个为0 end:结束位置,注意不包含结束的下标元素

func DeleteAllSpace

func DeleteAllSpace(s string) string

DeleteAllSpace 删除掉空格,tab,回车,换行

func DeletePrev0

func DeletePrev0(s string) string

DeletePrev0 删除掉前面的0,或多个0

func RetryFunc

func RetryFunc(maxBout int, sleepTime time.Duration, ptLog bool, fx func() (bool, error)) (err error)

RetryFunc 如果函数运行失败则重试,如果函数运行成功则结束 maxBout:最大重试次数 sleepTime:重试间隔时间 ptLog:是否打印错误日志 fx:要执行的函数,函数返回值1:是否继续重试至最大次数;函数返回值2:错误信息 返回值:错误信息

func RetryFuncErr

func RetryFuncErr(maxBout int, sleepTime time.Duration, ptLog bool, fx func() error) (err error)

RetryFuncErr 如果函数运行失败则重试,如果函数运行成功则结束 maxBout:最大重试次数 sleepTime:重试间隔时间 ptLog:是否打印错误日志 fx:要执行的函数,函数返回值1:是否继续重试至最大次数;函数返回值2:错误信息 返回值:错误信息

Types

type IntUintStringByte added in v0.0.9

type IntUintStringByte interface {
	~int8 | ~int16 | ~int32 | ~int64 |
		~uint8 | ~uint16 | ~uint32 | ~uint64 |
		~string | ~byte
}

type IntUintStringByteFloat added in v0.0.9

type IntUintStringByteFloat interface {
	~int8 | ~int16 | ~int32 | ~int64 |
		~uint8 | ~uint16 | ~uint32 | ~uint64 |
		~string | ~byte |
		~float32 | ~float64
}

Jump to

Keyboard shortcuts

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