1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
dudaodong
a3a24fc381 doc: update doc styles 2025-06-06 14:33:54 +08:00
Axiss
9caf2ffb1c fix one typo in doc (#310) 2025-06-03 10:10:51 +08:00
残念
1a5c31fd02 perf(retry): remove the waiting time after the last retry (#309) 2025-06-03 09:57:29 +08:00
5 changed files with 13 additions and 13 deletions

View File

@@ -2,10 +2,9 @@
outline: deep
---
# API概述
<b>lancet柳叶刀是一个功能强大、全面、高效、可复用的go语言工具函数库。包含25个包超过600个工具函数。功能涵盖字符串处理、切片处理、网络、并发、加解密、文件处理、时间/日期、流处理、迭代器等等。</b>
# API 概述
<b>lancet柳叶刀是一个功能强大、全面、高效、可复用的 go 语言工具函数库。包含 25 个包,超过 600 个工具函数。功能涵盖字符串处理、切片处理、网络、并发、加解密、文件处理、时间/日期、流处理、迭代器等等。</b>
<style>
.package-title {
@@ -27,7 +26,7 @@ outline: deep
display: inline-block;
vertical-align: middle;
line-height: 40px;
background: #10b981;
background: #6cadf5;
border: 1px solid;
margin-right: 10px;
margin-bottom: 10px;
@@ -67,4 +66,4 @@ outline: deep
<div class="package-cell">validator</div>
<div class="package-cell">xerror</div>
</div>
</div>
</div>

View File

@@ -8,7 +8,7 @@ algorithm 算法包实现一些基本算法sortsearchlrucache。
- [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/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>

View File

@@ -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>
<style>
.package-title {
color: black;
@@ -27,7 +26,7 @@ outline: deep
display: inline-block;
vertical-align: middle;
line-height: 40px;
background: #059669;
background: #6cadf5;
border: 1px solid;
margin-right: 10px;
margin-bottom: 10px;
@@ -47,6 +46,7 @@ outline: deep
<div class="package-cell">cryptor</div>
<div class="package-cell">datastructure</div>
<div class="package-cell">datetime</div>
<div class="package-cell">eventbus</div>
<div class="package-cell">fileutil</div>
<div class="package-cell">formatter</div>
<div class="package-cell">function</div>
@@ -67,4 +67,3 @@ outline: deep
<div class="package-cell">xerror</div>
</div>
</div>

View File

@@ -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/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>

View File

@@ -130,14 +130,16 @@ func Retry(retryFunc RetryFunc, opts ...Option) error {
var i uint
for i < config.retryTimes {
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 {
case <-time.After(config.backoffStrategy.CalculateInterval()):
case <-config.context.Done():
return errors.New("retry is cancelled")
}
} else {
return nil
}
i++
}