mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
update readme file
This commit is contained in:
32
README.md
32
README.md
@@ -69,7 +69,7 @@ func main() {
|
||||
|
||||
## API Documentation
|
||||
|
||||
### Algorithm package implements some basic algorithm. eg. sort, search.
|
||||
### 1. Algorithm package implements some basic algorithm. eg. sort, search.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/algorithm"
|
||||
@@ -90,7 +90,7 @@ import "github.com/duke-git/lancet/v2/algorithm"
|
||||
|
||||
|
||||
|
||||
### Concurrency package contain some functions to support concurrent programming. eg, goroutine, channel, async.
|
||||
### 2. Concurrency package contain some functions to support concurrent programming. eg, goroutine, channel, async.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/concurrency"
|
||||
@@ -107,7 +107,7 @@ import "github.com/duke-git/lancet/v2/concurrency"
|
||||
- [Take](https://github.com/duke-git/lancet/blob/main/docs/concurrency.md#Take)
|
||||
- [Tee](https://github.com/duke-git/lancet/blob/main/docs/concurrency.md#Tee)
|
||||
|
||||
### Convertor package contains some functions for data convertion.
|
||||
### 3. Convertor package contains some functions for data convertion.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/convertor"
|
||||
@@ -123,7 +123,7 @@ import "github.com/duke-git/lancet/v2/convertor"
|
||||
- [ToString](https://github.com/duke-git/lancet/blob/main/docs/convertor.md#ToString)
|
||||
- [StructToMap](https://github.com/duke-git/lancet/blob/main/docs/convertor.md#StructToMap)
|
||||
|
||||
### Cryptor package is for data encryption and decryption.
|
||||
### 4. Cryptor package is for data encryption and decryption.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/cryptor"
|
||||
@@ -163,7 +163,7 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
||||
- [RsaEncrypt](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#RsaEncrypt)
|
||||
- [RsaDecrypt](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#RsaDecrypt)
|
||||
|
||||
### Datetime package supports date and time format and compare.
|
||||
### 5. Datetime package supports date and time format and compare.
|
||||
|
||||
|
||||
```go
|
||||
@@ -201,7 +201,7 @@ import "github.com/duke-git/lancet/v2/datetime"
|
||||
- [ToFormatForTpl](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#ToFormatForTpl)
|
||||
- [ToIso8601](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#ToIso8601)
|
||||
|
||||
### Fileutil package implements some basic functions for file operations.
|
||||
### 6. Fileutil package implements some basic functions for file operations.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/fileutil"
|
||||
@@ -224,7 +224,7 @@ import "github.com/duke-git/lancet/v2/fileutil"
|
||||
- [Zip](https://github.com/duke-git/lancet/blob/main/docs/fileutil.md#Zip)
|
||||
- [UnZip](https://github.com/duke-git/lancet/blob/main/docs/fileutil.md#UnZip)
|
||||
|
||||
### Formatter contains some functions for data formatting.
|
||||
### 7. Formatter contains some functions for data formatting.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/formatter"
|
||||
@@ -248,7 +248,7 @@ import "github.com/duke-git/lancet/v2/function"
|
||||
- [Watcher](https://github.com/duke-git/lancet/blob/main/docs/function.md#Watcher)
|
||||
|
||||
|
||||
### Maputil package includes some functions to manipulate map.
|
||||
### 8. Maputil package includes some functions to manipulate map.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/maputil"
|
||||
@@ -264,7 +264,7 @@ import "github.com/duke-git/lancet/v2/maputil"
|
||||
- [Values](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#Values)
|
||||
|
||||
|
||||
### Mathutil package implements some functions for math calculation.
|
||||
### 9. Mathutil package implements some functions for math calculation.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/mathutil"
|
||||
@@ -283,7 +283,7 @@ import "github.com/duke-git/lancet/v2/mathutil"
|
||||
- [TruncRound](https://github.com/duke-git/lancet/blob/main/docs/mathutil.md#TruncRound)
|
||||
|
||||
|
||||
### Netutil package contains functions to get net information and send http request.
|
||||
### 10. Netutil package contains functions to get net information and send http request.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/netutil"
|
||||
@@ -303,7 +303,7 @@ import "github.com/duke-git/lancet/v2/netutil"
|
||||
- [HttpPatch](https://github.com/duke-git/lancet/blob/main/docs/netutil.md#HttpPatch)
|
||||
- [ParseHttpResponse](https://github.com/duke-git/lancet/blob/main/docs/netutil.md#ParseHttpResponse)
|
||||
|
||||
### Random package implements some basic functions to generate random int and string.
|
||||
### 11. Random package implements some basic functions to generate random int and string.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/random"
|
||||
@@ -315,7 +315,7 @@ import "github.com/duke-git/lancet/v2/random"
|
||||
- [RandString](https://github.com/duke-git/lancet/blob/main/docs/random.md#RandString)
|
||||
- [UUIdV4](https://github.com/duke-git/lancet/blob/main/docs/random.md#UUIdV4)
|
||||
|
||||
### Retry package is for executing a function repeatedly until it was successful or canceled by the context.
|
||||
### 12. Retry package is for executing a function repeatedly until it was successful or canceled by the context.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/retry"
|
||||
@@ -371,7 +371,7 @@ import "github.com/duke-git/lancet/v2/slice"
|
||||
- [UpdateAt](https://github.com/duke-git/lancet/blob/main/docs/slice.md#UpdateAt)
|
||||
- [Without](https://github.com/duke-git/lancet/blob/main/docs/slice.md#Without)
|
||||
|
||||
### Strutil package contains some functions to manipulate string.
|
||||
### 13. Strutil package contains some functions to manipulate string.
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/strutil"
|
||||
```
|
||||
@@ -395,7 +395,7 @@ import "github.com/duke-git/lancet/v2/strutil"
|
||||
- [Wrap](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#Wrap)
|
||||
- [Unwrap](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#Unwrap)
|
||||
|
||||
### System package contain some functions about os, runtime, shell command.
|
||||
### 14. System package contain some functions about os, runtime, shell command.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/system"
|
||||
@@ -410,7 +410,7 @@ import "github.com/duke-git/lancet/v2/system"
|
||||
- [CompareOsEnv](https://github.com/duke-git/lancet/blob/main/docs/system.md#CompareOsEnv)
|
||||
- [ExecCommand](https://github.com/duke-git/lancet/blob/main/docs/system.md#ExecCommand)
|
||||
|
||||
### Validator package contains some functions for data validation.
|
||||
### 15. Validator package contains some functions for data validation.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/validator"
|
||||
@@ -444,7 +444,7 @@ import "github.com/duke-git/lancet/v2/validator"
|
||||
- [IsStrongPassword](https://github.com/duke-git/lancet/blob/main/docs/validator.md#IsStrongPassword)
|
||||
- [IsUrl](https://github.com/duke-git/lancet/blob/main/docs/validator.md#IsUrl)
|
||||
- [IsWeakPassword](https://github.com/duke-git/lancet/blob/main/docs/validator.md#IsWeakPassword)
|
||||
### xerror package implements helpers for errors.
|
||||
### 16. xerror package implements helpers for errors.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/xerror"
|
||||
|
||||
@@ -69,7 +69,7 @@ func main() {
|
||||
|
||||
## API文档
|
||||
|
||||
### algorithm算法包实现一些基本算法。eg. sort, search.
|
||||
### 1. algorithm算法包实现一些基本算法。eg. sort, search.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/algorithm"
|
||||
@@ -106,7 +106,7 @@ import "github.com/duke-git/lancet/v2/concurrency"
|
||||
- [Take](https://github.com/duke-git/lancet/blob/main/docs/concurrency_zh-CN.md#Take)
|
||||
- [Tee](https://github.com/duke-git/lancet/blob/main/docs/concurrency_zh-CN.md#Tee)
|
||||
|
||||
### convertor转换器包支持一些常见的数据类型转换。
|
||||
### 2. convertor转换器包支持一些常见的数据类型转换。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/convertor"
|
||||
@@ -122,7 +122,7 @@ import "github.com/duke-git/lancet/v2/convertor"
|
||||
- [ToString](https://github.com/duke-git/lancet/blob/main/docs/convertor_zh-CN.md#ToString)
|
||||
- [StructToMap](https://github.com/duke-git/lancet/blob/main/docs/convertor_zh-CN.md#StructToMap)
|
||||
|
||||
### cryptor加密包支持数据加密和解密,获取md5,hash值。支持base64, md5, hmac, aes, des, rsa。
|
||||
### 3. cryptor加密包支持数据加密和解密,获取md5,hash值。支持base64, md5, hmac, aes, des, rsa。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/cryptor"
|
||||
@@ -162,7 +162,7 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
||||
- [RsaEncrypt](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#RsaEncrypt)
|
||||
- [RsaDecrypt](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#RsaDecrypt)
|
||||
|
||||
### datetime日期时间处理包,格式化日期,比较日期。
|
||||
### 4. datetime日期时间处理包,格式化日期,比较日期。
|
||||
|
||||
|
||||
```go
|
||||
@@ -200,7 +200,7 @@ import "github.com/duke-git/lancet/v2/datetime"
|
||||
- [ToFormatForTpl](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#ToFormatForTpl)
|
||||
- [ToIso8601](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#ToIso8601)
|
||||
|
||||
### fileutil包支持文件基本操作。
|
||||
### 5. fileutil包支持文件基本操作。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/fileutil"
|
||||
@@ -223,7 +223,7 @@ import "github.com/duke-git/lancet/v2/fileutil"
|
||||
- [Zip](https://github.com/duke-git/lancet/blob/main/docs/fileutil_zh-CN.md#Zip)
|
||||
- [UnZip](https://github.com/duke-git/lancet/blob/main/docs/fileutil_zh-CN.md#UnZip)
|
||||
|
||||
### formatter格式化器包含一些数据格式化处理方法。
|
||||
### 6. formatter格式化器包含一些数据格式化处理方法。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/formatter"
|
||||
@@ -232,7 +232,7 @@ import "github.com/duke-git/lancet/v2/formatter"
|
||||
- [Comma](https://github.com/duke-git/lancet/blob/main/docs/formatter_zh-CN.md#Comma)
|
||||
|
||||
|
||||
### function函数包控制函数执行流程,包含部分函数式编程。
|
||||
### 7. function函数包控制函数执行流程,包含部分函数式编程。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/function"
|
||||
@@ -248,7 +248,7 @@ import "github.com/duke-git/lancet/v2/function"
|
||||
- [Watcher](https://github.com/duke-git/lancet/blob/main/docs/function_zh-CN.md#Watcher)
|
||||
|
||||
|
||||
### maputil包包括一些操作map的函数.
|
||||
### 8. maputil包包括一些操作map的函数.
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/maputil"
|
||||
@@ -281,7 +281,7 @@ import "github.com/duke-git/lancet/v2/mathutil"
|
||||
- [RoundToString](https://github.com/duke-git/lancet/blob/main/docs/mathutil_zh-CN.md#RoundToString)
|
||||
- [TruncRound](https://github.com/duke-git/lancet/blob/main/docs/mathutil_zh-CN.md#TruncRound)
|
||||
|
||||
### netutil网络包支持获取ip地址,发送http请求。
|
||||
### 9. netutil网络包支持获取ip地址,发送http请求。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/netutil"
|
||||
@@ -301,7 +301,7 @@ import "github.com/duke-git/lancet/v2/netutil"
|
||||
- [HttpPatch](https://github.com/duke-git/lancet/blob/main/docs/netutil_zh-CN.md#HttpPatch)
|
||||
- [ParseHttpResponse](https://github.com/duke-git/lancet/blob/main/docs/netutil_zh-CN.md#ParseHttpResponse)
|
||||
|
||||
### random随机数生成器包,可以生成随机[]bytes, int, string。
|
||||
### 10. random随机数生成器包,可以生成随机[]bytes, int, string。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/random"
|
||||
@@ -312,7 +312,7 @@ import "github.com/duke-git/lancet/v2/random"
|
||||
- [RandInt](https://github.com/duke-git/lancet/blob/main/docs/random_zh-CN.md#RandInt)
|
||||
- [RandString](https://github.com/duke-git/lancet/blob/main/docs/random_zh-CN.md#RandString)
|
||||
- [UUIdV4](https://github.com/duke-git/lancet/blob/main/docs/random.md#UUIdV4)
|
||||
### retry重试执行函数直到函数运行成功或被context cancel。
|
||||
### 11. retry重试执行函数直到函数运行成功或被context cancel。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/retry"
|
||||
@@ -326,7 +326,7 @@ import "github.com/duke-git/lancet/v2/retry"
|
||||
- [RetryTimes](https://github.com/duke-git/lancet/blob/main/docs/retry_zh-CN.md#RetryTimes)
|
||||
|
||||
|
||||
### slice包包含操作切片的方法集合。
|
||||
### 12. slice包包含操作切片的方法集合。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/slice"
|
||||
@@ -370,7 +370,7 @@ import "github.com/duke-git/lancet/v2/slice"
|
||||
- [Without](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#Without)
|
||||
|
||||
|
||||
### strutil包含处理字符串的相关函数。
|
||||
### 13. strutil包含处理字符串的相关函数。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/strutil"
|
||||
@@ -396,7 +396,7 @@ import "github.com/duke-git/lancet/v2/strutil"
|
||||
- [Unwrap](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#Unwrap)
|
||||
|
||||
|
||||
### system包含os, runtime, shell command相关函数。
|
||||
### 14. system包含os, runtime, shell command相关函数。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/system"
|
||||
@@ -412,7 +412,7 @@ import "github.com/duke-git/lancet/v2/system"
|
||||
- [CompareOsEnv](https://github.com/duke-git/lancet/blob/main/docs/system_zh-CN.md#CompareOsEnv)
|
||||
- [ExecCommand](https://github.com/duke-git/lancet/blob/main/docs/system_zh-CN.md#ExecCommand)
|
||||
|
||||
### validator验证器包,包含常用字符串格式验证函数。
|
||||
### 15. validator验证器包,包含常用字符串格式验证函数。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/validator"
|
||||
@@ -447,7 +447,7 @@ import "github.com/duke-git/lancet/v2/validator"
|
||||
- [IsWeakPassword](https://github.com/duke-git/lancet/blob/main/docs/validator_zh-CN.md#IsWeakPassword)
|
||||
|
||||
validator.md#IsWeakPassword)
|
||||
### xerror包实现一些错误处理函数
|
||||
### 16. xerror包实现一些错误处理函数
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/xerror"
|
||||
|
||||
Reference in New Issue
Block a user