mirror of
https://github.com/duke-git/lancet.git
synced 2026-03-01 00:35:28 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a3a24fc381 | |||
| 9caf2ffb1c | |||
| 1a5c31fd02 |
@@ -2,10 +2,9 @@
|
|||||||
outline: deep
|
outline: deep
|
||||||
---
|
---
|
||||||
|
|
||||||
# API概述
|
# API 概述
|
||||||
|
|
||||||
<b>lancet(柳叶刀)是一个功能强大、全面、高效、可复用的go语言工具函数库。包含25个包,超过600个工具函数。功能涵盖字符串处理、切片处理、网络、并发、加解密、文件处理、时间/日期、流处理、迭代器等等。</b>
|
|
||||||
|
|
||||||
|
<b>lancet(柳叶刀)是一个功能强大、全面、高效、可复用的 go 语言工具函数库。包含 25 个包,超过 600 个工具函数。功能涵盖字符串处理、切片处理、网络、并发、加解密、文件处理、时间/日期、流处理、迭代器等等。</b>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.package-title {
|
.package-title {
|
||||||
@@ -27,7 +26,7 @@ outline: deep
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
background: #10b981;
|
background: #6cadf5;
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -67,4 +66,4 @@ outline: deep
|
|||||||
<div class="package-cell">validator</div>
|
<div class="package-cell">validator</div>
|
||||||
<div class="package-cell">xerror</div>
|
<div class="package-cell">xerror</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ algorithm 算法包实现一些基本算法,sort,search,lrucache。
|
|||||||
|
|
||||||
- [https://github.com/duke-git/lancet/blob/main/algorithm/sort.go](https://github.com/duke-git/lancet/blob/main/algorithm/sort.go)
|
- [https://github.com/duke-git/lancet/blob/main/algorithm/sort.go](https://github.com/duke-git/lancet/blob/main/algorithm/sort.go)
|
||||||
- [https://github.com/duke-git/lancet/blob/main/algorithm/search.go](https://github.com/duke-git/lancet/blob/main/algorithm/search.go)
|
- [https://github.com/duke-git/lancet/blob/main/algorithm/search.go](https://github.com/duke-git/lancet/blob/main/algorithm/search.go)
|
||||||
- [https://github.com/duke-git/lancet/blob/main/algorithm/lru_cache.go](https://github.com/duke-git/lancet/blob/main/algorithm/lru_cache.go)
|
- [https://github.com/duke-git/lancet/blob/main/algorithm/lrucache.go](https://github.com/duke-git/lancet/blob/main/algorithm/lrucache.go)
|
||||||
|
|
||||||
<div STYLE="page-break-after: always;"></div>
|
<div STYLE="page-break-after: always;"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ outline: deep
|
|||||||
|
|
||||||
<b>Lancet (Lancet) is a powerful, comprehensive, efficient and reusable go language tool function library. Contains 25 packages, more than 600 utility functions. Functions cover string processing, slice processing, network, concurrency, encryption and decryption, file processing, time/date, stream processing, iterators, and more.</b>
|
<b>Lancet (Lancet) is a powerful, comprehensive, efficient and reusable go language tool function library. Contains 25 packages, more than 600 utility functions. Functions cover string processing, slice processing, network, concurrency, encryption and decryption, file processing, time/date, stream processing, iterators, and more.</b>
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.package-title {
|
.package-title {
|
||||||
color: black;
|
color: black;
|
||||||
@@ -27,7 +26,7 @@ outline: deep
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
background: #059669;
|
background: #6cadf5;
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -47,6 +46,7 @@ outline: deep
|
|||||||
<div class="package-cell">cryptor</div>
|
<div class="package-cell">cryptor</div>
|
||||||
<div class="package-cell">datastructure</div>
|
<div class="package-cell">datastructure</div>
|
||||||
<div class="package-cell">datetime</div>
|
<div class="package-cell">datetime</div>
|
||||||
|
<div class="package-cell">eventbus</div>
|
||||||
<div class="package-cell">fileutil</div>
|
<div class="package-cell">fileutil</div>
|
||||||
<div class="package-cell">formatter</div>
|
<div class="package-cell">formatter</div>
|
||||||
<div class="package-cell">function</div>
|
<div class="package-cell">function</div>
|
||||||
@@ -67,4 +67,3 @@ outline: deep
|
|||||||
<div class="package-cell">xerror</div>
|
<div class="package-cell">xerror</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Package algorithm implements some basic algorithm. eg. sort, search.
|
|||||||
|
|
||||||
- [https://github.com/duke-git/lancet/blob/main/algorithm/sort.go](https://github.com/duke-git/lancet/blob/main/algorithm/sort.go)
|
- [https://github.com/duke-git/lancet/blob/main/algorithm/sort.go](https://github.com/duke-git/lancet/blob/main/algorithm/sort.go)
|
||||||
- [https://github.com/duke-git/lancet/blob/main/algorithm/search.go](https://github.com/duke-git/lancet/blob/main/algorithm/search.go)
|
- [https://github.com/duke-git/lancet/blob/main/algorithm/search.go](https://github.com/duke-git/lancet/blob/main/algorithm/search.go)
|
||||||
- [https://github.com/duke-git/lancet/blob/main/algorithm/lru_cache.go](https://github.com/duke-git/lancet/blob/main/algorithm/lru_cache.go)
|
- [https://github.com/duke-git/lancet/blob/main/algorithm/lrucache.go](https://github.com/duke-git/lancet/blob/main/algorithm/lrucache.go)
|
||||||
|
|
||||||
<div STYLE="page-break-after: always;"></div>
|
<div STYLE="page-break-after: always;"></div>
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -130,14 +130,16 @@ func Retry(retryFunc RetryFunc, opts ...Option) error {
|
|||||||
var i uint
|
var i uint
|
||||||
for i < config.retryTimes {
|
for i < config.retryTimes {
|
||||||
err := retryFunc()
|
err := retryFunc()
|
||||||
if err != nil {
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if i < config.retryTimes-1 { // Only wait if it's not the last retry
|
||||||
select {
|
select {
|
||||||
case <-time.After(config.backoffStrategy.CalculateInterval()):
|
case <-time.After(config.backoffStrategy.CalculateInterval()):
|
||||||
case <-config.context.Done():
|
case <-config.context.Done():
|
||||||
return errors.New("retry is cancelled")
|
return errors.New("retry is cancelled")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user