imix

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopy added in v0.0.9

func DeepCopy[T any](src T) (T, error)

func If added in v0.0.5

func If[T any](con bool, one, another T) T

If 三目运算

func IfDelay added in v0.1.13

func IfDelay[T any](con bool, one, another func() T) T

func SimpleRetry

func SimpleRetry[T any](do func() (data T, err error), maxTimes int) (result T, err error)

func SimpleRetryWithDelay added in v0.1.13

func SimpleRetryWithDelay[T any](do func() (data T, err error), maxTimes int, delay time.Duration) (result T, err error)

SimpleRetry 一个简单的重试工具

参数:

do:处理函数, 返回 data是函数返回数据,也是SimpleRetry最终返回的数据;ok 表示是否处理成功,成功则结束重试
maxTimes: 最大重试次数

返回值:

result: 对应do函数的返回值
err: 代表最终结果是否成功

Types

This section is empty.

Jump to

Keyboard shortcuts

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