mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-07 06:02:27 +08:00
doc: add package index
This commit is contained in:
79
README.md
79
README.md
@@ -73,7 +73,36 @@ func main() {
|
||||
|
||||
## Documentation
|
||||
|
||||
### 1. Algorithm package implements some basic algorithm. eg. sort, search.
|
||||
### <span id="index">Index<span>
|
||||
|
||||
- [Algorithm](#Algorithm)
|
||||
- [Compare](#Compare)
|
||||
- [Concurrency](#Concurrency)
|
||||
- [Condition](#Condition)
|
||||
- [Convetor](#Convetor)
|
||||
- [Cryptor](#Cryptor)
|
||||
- [Datetime](#Datetime)
|
||||
- [Datastructure](#Datastructure)
|
||||
- [Fileutil](#Fileutil)
|
||||
- [Formatter](#Formatter)
|
||||
- [Function](#Function)
|
||||
- [Iterator](#Iterator)
|
||||
- [Maputil](#Maputil)
|
||||
- [Mathutil](#Mathutil)
|
||||
- [Netutil](#Netutil)
|
||||
- [Pointer](#Pointer)
|
||||
- [Random](#Random)
|
||||
- [Retry](#Retry)
|
||||
- [Slice](#Slice)
|
||||
- [Stream](#Stream)
|
||||
- [Structs](#Structs)
|
||||
- [Strutil](#Strutil)
|
||||
- [System](#System)
|
||||
- [Tuple](#Tuple)
|
||||
- [Validator](#Validator)
|
||||
- [Xerror](#Xerror)
|
||||
|
||||
### <span id="Algorithm">1. Algorithm package implements some basic algorithm. eg. sort, search.</span></span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/algorithm"
|
||||
@@ -118,7 +147,7 @@ import "github.com/duke-git/lancet/v2/algorithm"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/algorithm.md#LRUCache)]
|
||||
[[play](https://go.dev/play/p/-EZjgOURufP)]
|
||||
|
||||
### 2. Compare package provides a lightweight comparison function on any type.
|
||||
### <span id="Compare">2. Compare package provides a lightweight comparison function on any type.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/compare"
|
||||
@@ -145,7 +174,7 @@ import "github.com/duke-git/lancet/v2/compare"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/compare.md#GreaterOrEqual)]
|
||||
[[play](https://go.dev/play/p/vx8mP0U8DFk)]
|
||||
|
||||
### 3. Concurrency package contain some functions to support concurrent programming. eg, goroutine, channel, async.
|
||||
### <span id="Concurrency">3. Concurrency package contain some functions to support concurrent programming. eg, goroutine, channel, async.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/concurrency"
|
||||
@@ -184,7 +213,7 @@ import "github.com/duke-git/lancet/v2/concurrency"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/concurrency.md#Tee)]
|
||||
[[play](https://go.dev/play/p/3TQPKnCirrP)]
|
||||
|
||||
### 4. Condition package contains some functions for conditional judgment. eg. And, Or, TernaryOperator...
|
||||
### <span id="Condition">4. Condition package contains some functions for conditional judgment. eg. And, Or, TernaryOperator...</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/condition"
|
||||
@@ -217,7 +246,7 @@ import "github.com/duke-git/lancet/v2/condition"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/condition.md#TernaryOperator)]
|
||||
[[play](https://go.dev/play/p/ElllPZY0guT)]
|
||||
|
||||
### 5. Convertor package contains some functions for data convertion.
|
||||
### <span id="Convertor">5. Convertor package contains some functions for data convertion.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/convertor"
|
||||
@@ -289,7 +318,7 @@ import "github.com/duke-git/lancet/v2/convertor"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/convertor.md#GbkToUtf8)]
|
||||
[[play](https://go.dev/play/p/OphmHCN_9u8)]
|
||||
|
||||
### 6. Cryptor package is for data encryption and decryption.
|
||||
### <span id="Cryptor">6. Cryptor package is for data encryption and decryption.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/cryptor"
|
||||
@@ -393,7 +422,7 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#RsaDecrypt)]
|
||||
[[play](https://go.dev/play/p/uef0q1fz53I)]
|
||||
|
||||
### 7. Datetime package supports date and time format and compare.
|
||||
### <span id="Datetime">7. Datetime package supports date and time format and compare.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/datetime"
|
||||
@@ -507,7 +536,7 @@ import "github.com/duke-git/lancet/v2/datetime"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#IsWeekend)]
|
||||
[[play](https://go.dev/play/p/cupRM5aZOIY)]
|
||||
|
||||
### 8. Datastructure package constains some common data structure. eg. list, linklist, stack, queue, set, tree, graph.
|
||||
### <span id="Datastructure">8. Datastructure package constains some common data structure. eg. list, linklist, stack, queue, set, tree, graph.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import list "github.com/duke-git/lancet/v2/datastructure/list"
|
||||
@@ -539,7 +568,7 @@ import hashmap "github.com/duke-git/lancet/v2/datastructure/hashmap"
|
||||
- **<big>Hashmap</big>** : hash map structure.
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datastructure/hashmap.md)]
|
||||
|
||||
### 9. Fileutil package implements some basic functions for file operations.
|
||||
### <span id="Fileutil">9. Fileutil package implements some basic functions for file operations.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/fileutil"
|
||||
@@ -622,7 +651,7 @@ import "github.com/duke-git/lancet/v2/fileutil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil.md#WriteStringToFile)]
|
||||
[[play](https://go.dev/play/p/GhLS6d8lH_g)]
|
||||
|
||||
### 10. Formatter contains some functions for data formatting.
|
||||
### <span id="Formatter">10. Formatter contains some functions for data formatting.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/formatter"
|
||||
@@ -652,7 +681,7 @@ import "github.com/duke-git/lancet/v2/formatter"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/formatter.md#ParseBinaryBytes)]
|
||||
[[play](https://go.dev/play/p/69v1tTT62x8)]
|
||||
|
||||
### 11. Function package can control the flow of function execution and support part of functional programming
|
||||
### <span id="Function">11. Function package can control the flow of function execution and support part of functional programming.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/function"
|
||||
@@ -688,7 +717,7 @@ import "github.com/duke-git/lancet/v2/function"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/function.md#Watcher)]
|
||||
[[play](https://go.dev/play/p/l2yrOpCLd1I)]
|
||||
|
||||
### 12. Maputil package includes some functions to manipulate map.
|
||||
### <span id="Maputil">12. Maputil package includes some functions to manipulate map.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/maputil"
|
||||
@@ -760,7 +789,7 @@ import "github.com/duke-git/lancet/v2/maputil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#IsDisjoint)]
|
||||
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
|
||||
|
||||
### 13. Mathutil package implements some functions for math calculation.
|
||||
### <span id="Mathutil">13. Mathutil package implements some functions for math calculation.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/mathutil"
|
||||
@@ -841,7 +870,7 @@ import "github.com/duke-git/lancet/v2/mathutil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil.md#Sum)]
|
||||
[[play](https://go.dev/play/p/1To2ImAMJA7)]
|
||||
|
||||
### 14. Netutil package contains functions to get net information and send http request.
|
||||
### <span id="Netutil">14. Netutil package contains functions to get net information and send http request.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/netutil"
|
||||
@@ -914,7 +943,7 @@ import "github.com/duke-git/lancet/v2/netutil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/netutil.md#IsTelnetConnected)]
|
||||
[[play](https://go.dev/play/p/yiLCGtQv_ZG)]
|
||||
|
||||
### 15. Pointer package contains some util functions to operate go pointer.
|
||||
### <span id="Pointer">15. Pointer package contains some util functions to operate go pointer.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/pointer"
|
||||
@@ -932,7 +961,7 @@ import "github.com/duke-git/lancet/v2/pointer"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/pointer.md#Unwrap)]
|
||||
[[play](https://go.dev/play/p/cgeu3g7cjWb)]
|
||||
|
||||
### 16. Random package implements some basic functions to generate random int and string.
|
||||
### <span id="Random">16. Random package implements some basic functions to generate random int and string.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/random"
|
||||
@@ -968,7 +997,7 @@ import "github.com/duke-git/lancet/v2/random"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/random.md#RandUniqueIntSlice)]
|
||||
[[play](https://go.dev/play/p/uBkRSOz73Ec)]
|
||||
|
||||
### 17. Retry package is for executing a function repeatedly until it was successful or canceled by the context.
|
||||
### <span id="Retry">17. Retry package is for executing a function repeatedly until it was successful or canceled by the context.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/retry"
|
||||
@@ -992,7 +1021,7 @@ import "github.com/duke-git/lancet/v2/retry"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/retry.md#RetryTimes)]
|
||||
[[play](https://go.dev/play/p/ssfVeU2SwLO)]
|
||||
|
||||
### 18. Slice contains some functions to manipulate slice.
|
||||
### <span id="Slice">18. Slice contains some functions to manipulate slice.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/slice"
|
||||
@@ -1205,7 +1234,7 @@ import "github.com/duke-git/lancet/v2/slice"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#KeyBy)]
|
||||
[[play](https://go.dev/play/p/uXod2LWD1Kg)]
|
||||
|
||||
### 19. Stream package implements a sequence of elements supporting sequential and operations. this package is an experiment to explore if stream in go can work as the way java does. its function is very limited.
|
||||
### <span id="Stream">19. Stream package implements a sequence of elements supporting sequential and operations. this package is an experiment to explore if stream in go can work as the way java does. its function is very limited.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/stream"
|
||||
@@ -1292,7 +1321,7 @@ import "github.com/duke-git/lancet/v2/stream"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/stream.md#ToSlice)]
|
||||
[[play](https://go.dev/play/p/jI6_iZZuVFE)]
|
||||
|
||||
### 20. Structs package provides several high level functions to manipulate struct, tag, and field.
|
||||
### <span id="Structs">20. Structs package provides several high level functions to manipulate struct, tag, and field.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/structs"
|
||||
@@ -1325,7 +1354,7 @@ import "github.com/duke-git/lancet/v2/structs"
|
||||
- **<big>IsSlice</big>** : check if the field is a slice
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/structs/field.md#IsSlice)]
|
||||
|
||||
### 21. Strutil package contains some functions to manipulate string.
|
||||
### <span id="Strutil">21. Strutil package contains some functions to manipulate string.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/strutil"
|
||||
@@ -1443,7 +1472,7 @@ import "github.com/duke-git/lancet/v2/strutil"
|
||||
- **<big>RemoveWhiteSpace</big>** : remove whitespace characters from a string.
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#RemoveWhiteSpace)]
|
||||
|
||||
### 22. System package contain some functions about os, runtime, shell command.
|
||||
### <span id="System">22. System package contain some functions about os, runtime, shell command.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/system"
|
||||
@@ -1479,7 +1508,7 @@ import "github.com/duke-git/lancet/v2/system"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/system.md#GetOsBits)]
|
||||
[[play](https://go.dev/play/p/ml-_XH3gJbW)]
|
||||
|
||||
### 23. Tuple package implements tuple data type and some operations on it.
|
||||
### <span id="Tuple">23. Tuple package implements tuple data type and some operations on it.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/tuple"
|
||||
@@ -1560,7 +1589,7 @@ import "github.com/duke-git/lancet/v2/tuple"
|
||||
- **<big>Unzip10</big>** : create a group of slice from a slice of Tuple10.
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip10)]
|
||||
|
||||
### 24. Validator package contains some functions for data validation.
|
||||
### <span id="Validator">24. Validator package contains some functions for data validation.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/validator"
|
||||
@@ -1668,7 +1697,7 @@ import "github.com/duke-git/lancet/v2/validator"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/validator.md#IsPrintable)]
|
||||
[[play](https://go.dev/play/p/Pe1FE2gdtTP)]
|
||||
|
||||
### 25. xerror package implements helpers for errors.
|
||||
### <span id="Xerror">25. xerror package implements helpers for errors.</span> [index](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/xerror"
|
||||
|
||||
@@ -72,7 +72,36 @@ func main() {
|
||||
|
||||
## 文档
|
||||
|
||||
### 1. algorithm 包实现一些基本查找和排序算法。
|
||||
### <span id="index">目录<span>
|
||||
|
||||
- [Algorithm](#Algorithm)
|
||||
- [Compare](#Compare)
|
||||
- [Concurrency](#Concurrency)
|
||||
- [Condition](#Condition)
|
||||
- [Convetor](#Convetor)
|
||||
- [Cryptor](#Cryptor)
|
||||
- [Datetime](#Datetime)
|
||||
- [Datastructure](#Datastructure)
|
||||
- [Fileutil](#Fileutil)
|
||||
- [Formatter](#Formatter)
|
||||
- [Function](#Function)
|
||||
- [Iterator](#Iterator)
|
||||
- [Maputil](#Maputil)
|
||||
- [Mathutil](#Mathutil)
|
||||
- [Netutil](#Netutil)
|
||||
- [Pointer](#Pointer)
|
||||
- [Random](#Random)
|
||||
- [Retry](#Retry)
|
||||
- [Slice](#Slice)
|
||||
- [Stream](#Stream)
|
||||
- [Structs](#Structs)
|
||||
- [Strutil](#Strutil)
|
||||
- [System](#System)
|
||||
- [Tuple](#Tuple)
|
||||
- [Validator](#Validator)
|
||||
- [Xerror](#Xerror)
|
||||
|
||||
### <span id="Algorithm">1. algorithm 包实现一些基本查找和排序算法。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/algorithm"
|
||||
@@ -117,7 +146,7 @@ import "github.com/duke-git/lancet/v2/algorithm"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/algorithm_zh-CN.md#LRUCache)]
|
||||
[[play](https://go.dev/play/p/-EZjgOURufP)]
|
||||
|
||||
### 2. compare 包提供几个轻量级的类型比较函数。
|
||||
### <span id="Compare">2. compare 包提供几个轻量级的类型比较函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/compare"
|
||||
@@ -144,7 +173,7 @@ import "github.com/duke-git/lancet/v2/compare"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/compare_zh-CN.md#GreaterOrEqual)]
|
||||
[[play](https://go.dev/play/p/vx8mP0U8DFk)]
|
||||
|
||||
### 3. concurrency 包含一些支持并发编程的功能。例如:goroutine, channel, async 等。
|
||||
### <span id="Concurrency">3. concurrency 包含一些支持并发编程的功能。例如:goroutine, channel, async 等。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/concurrency"
|
||||
@@ -183,7 +212,7 @@ import "github.com/duke-git/lancet/v2/concurrency"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/concurrency_zh-CN.md#Tee)]
|
||||
[[play](https://go.dev/play/p/3TQPKnCirrP)]
|
||||
|
||||
### 4. condition 包含一些用于条件判断的函数。
|
||||
### <span id="Condition">4. condition 包含一些用于条件判断的函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/condition"
|
||||
@@ -216,7 +245,7 @@ import "github.com/duke-git/lancet/v2/condition"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/condition_zh-CN.md#TernaryOperator)]
|
||||
[[play](https://go.dev/play/p/ElllPZY0guT)]
|
||||
|
||||
### 5. convertor 转换器包支持一些常见的数据类型转换。
|
||||
### <span id="Convertor">5. convertor 转换器包支持一些常见的数据类型转换。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/convertor"
|
||||
@@ -288,7 +317,7 @@ import "github.com/duke-git/lancet/v2/convertor"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/convertor_zh-CN.md#GbkToUtf8)]
|
||||
[[play](https://go.dev/play/p/OphmHCN_9u8)]
|
||||
|
||||
### 6. cryptor 加密包支持数据加密和解密,获取 md5,hash 值。支持 base64, md5, hmac, aes, des, rsa。
|
||||
### <span id="Cryptor">6. cryptor 加密包支持数据加密和解密,获取 md5,hash 值。支持 base64, md5, hmac, aes, des, rsa。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/cryptor"
|
||||
@@ -392,7 +421,7 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#RsaDecrypt)]
|
||||
[[play](https://go.dev/play/p/uef0q1fz53I)]
|
||||
|
||||
### 7. datetime 日期时间处理包,格式化日期,比较日期。
|
||||
### <span id="Datetime">7. datetime 日期时间处理包,格式化日期,比较日期。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/datetime"
|
||||
@@ -509,7 +538,7 @@ import "github.com/duke-git/lancet/v2/datetime"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#IsWeekend)]
|
||||
[[play](https://go.dev/play/p/cupRM5aZOIY)]
|
||||
|
||||
### 8. datastructure 包含一些普通的数据结构实现。例如:list, linklist, stack, queue, set, tree, graph.
|
||||
### <span id="Datastructure">8. datastructure 包含一些普通的数据结构实现。例如:list, linklist, stack, queue, set, tree, graph.</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import list "github.com/duke-git/lancet/v2/datastructure/list"
|
||||
@@ -541,7 +570,7 @@ import hashmap "github.com/duke-git/lancet/v2/datastructure/hashmap"
|
||||
- **<big>Hashmap</big>** : 哈希映射。
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datastructure/hashmap_zh-CN.md)]
|
||||
|
||||
### 9. fileutil 包含文件基本操作。
|
||||
### <span id="Fileutil">9. fileutil 包含文件基本操作。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/fileutil"
|
||||
@@ -624,7 +653,7 @@ import "github.com/duke-git/lancet/v2/fileutil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil_zh-CN.md#WriteStringToFile)]
|
||||
[[play](https://go.dev/play/p/GhLS6d8lH_g)]
|
||||
|
||||
### 10. formatter 格式化器包含一些数据格式化处理方法。
|
||||
### <span id="Formatter">10. formatter 格式化器包含一些数据格式化处理方法。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/formatter"
|
||||
@@ -654,7 +683,7 @@ import "github.com/duke-git/lancet/v2/formatter"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/formatter_zh-CN.md#ParseBinaryBytes)]
|
||||
[[play](https://go.dev/play/p/69v1tTT62x8)]
|
||||
|
||||
### 11. function 函数包控制函数执行流程,包含部分函数式编程。
|
||||
### <span id="Function">11. function 函数包控制函数执行流程,包含部分函数式编程。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/function"
|
||||
@@ -690,7 +719,7 @@ import "github.com/duke-git/lancet/v2/function"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/function_zh-CN.md#Watcher)]
|
||||
[[play](https://go.dev/play/p/l2yrOpCLd1I)]
|
||||
|
||||
### 12. maputil 包括一些操作 map 的函数.
|
||||
### <span id="Maputil">12. maputil 包括一些操作 map 的函数.</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/maputil"
|
||||
@@ -762,7 +791,7 @@ import "github.com/duke-git/lancet/v2/maputil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#IsDisjoint)]
|
||||
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
|
||||
|
||||
### 13. mathutil 包实现了一些数学计算的函数。
|
||||
### <span id="Mathutil">13. mathutil 包实现了一些数学计算的函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/mathutil"
|
||||
@@ -843,7 +872,7 @@ import "github.com/duke-git/lancet/v2/mathutil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil_zh-CN.md#Sum)]
|
||||
[[play](https://go.dev/play/p/1To2ImAMJA7)]
|
||||
|
||||
### 14. netutil 网络包支持获取 ip 地址,发送 http 请求。
|
||||
### <span id="Netutil">14. netutil 网络包支持获取 ip 地址,发送 http 请求。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/netutil"
|
||||
@@ -916,7 +945,7 @@ import "github.com/duke-git/lancet/v2/netutil"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/netutil_zh-CN.md#IsTelnetConnected)]
|
||||
[[play](https://go.dev/play/p/yiLCGtQv_ZG)]
|
||||
|
||||
### 15. Pointer 包支持一些指针类型的操作。
|
||||
### <span id="Pointer">15. pointer 包支持一些指针类型的操作。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/pointer"
|
||||
@@ -934,7 +963,7 @@ import "github.com/duke-git/lancet/v2/pointer"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/pointer_zh-CN.md#Unwrap)]
|
||||
[[play](https://go.dev/play/p/cgeu3g7cjWb)]
|
||||
|
||||
### 16. random 随机数生成器包,可以生成随机[]bytes, int, string。
|
||||
### <span id="Random">16. random 随机数生成器包,可以生成随机[]bytes, int, string。
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/random"
|
||||
@@ -970,7 +999,7 @@ import "github.com/duke-git/lancet/v2/random"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/random_zh-CN.md#RandUniqueIntSlice)]
|
||||
[[play](https://go.dev/play/p/uBkRSOz73Ec)]
|
||||
|
||||
### 17. retry 重试执行函数直到函数运行成功或被 context cancel。
|
||||
### <span id="Retry">17. retry 重试执行函数直到函数运行成功或被 context cancel。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/retry"
|
||||
@@ -994,7 +1023,7 @@ import "github.com/duke-git/lancet/v2/retry"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/retry_zh-CN.md#RetryTimes)]
|
||||
[[play](https://go.dev/play/p/ssfVeU2SwLO)]
|
||||
|
||||
### 18. slice 包含操作切片的方法集合。
|
||||
### <span id="Slice">18. slice 包含操作切片的方法集合。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/slice"
|
||||
@@ -1207,7 +1236,7 @@ import "github.com/duke-git/lancet/v2/slice"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#KeyBy)]
|
||||
[[play](https://go.dev/play/p/uXod2LWD1Kg)]
|
||||
|
||||
### 19. Stream 流,该包仅验证简单的 stream 实现,功能有限。
|
||||
### <span id="Stream">19. stream 流,该包仅验证简单的 stream 实现,功能有限。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/stream"
|
||||
@@ -1294,7 +1323,7 @@ import "github.com/duke-git/lancet/v2/stream"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/stream_zh-CN.md#ToSlice)]
|
||||
[[play](https://go.dev/play/p/jI6_iZZuVFE)]
|
||||
|
||||
### 20. structs 提供操作 struct, tag, field 的相关函数。
|
||||
### <span id="Structs">20. structs 提供操作 struct, tag, field 的相关函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/structs"
|
||||
@@ -1329,7 +1358,7 @@ import "github.com/duke-git/lancet/v2/structs"
|
||||
- **<big>IsSlice</big>** : 判断属性是否是切片。
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/structs/field_zh-CN.md#IsSlice)]
|
||||
|
||||
### 21. strutil 包含字符串处理的相关函数。
|
||||
### <span id="Strutil">21. strutil 包含字符串处理的相关函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/strutil"
|
||||
@@ -1448,7 +1477,7 @@ import "github.com/duke-git/lancet/v2/strutil"
|
||||
- **<big>RemoveWhiteSpace</big>** : 删除字符串中的空格。
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#RemoveWhiteSpace)]
|
||||
|
||||
### 22. system 包含 os, runtime, shell command 的相关函数。
|
||||
### <span id="System">22. system 包含 os, runtime, shell command 的相关函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/system"
|
||||
@@ -1484,7 +1513,7 @@ import "github.com/duke-git/lancet/v2/system"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/system_zh-CN#GetOsBits)]
|
||||
[[play](https://go.dev/play/p/ml-_XH3gJbW)]
|
||||
|
||||
### 23. Tuple 包实现一个元组数据类型。
|
||||
### <span id="Tuple">23. Tuple 包实现一个元组数据类型。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/tuple"
|
||||
@@ -1565,7 +1594,7 @@ import "github.com/duke-git/lancet/v2/tuple"
|
||||
- **<big>Unzip10</big>** : 根据传入的Tuple10切片,创建一组和Tuple10元素相对应的切片。
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip10)]
|
||||
|
||||
### 24. validator 验证器包,包含常用字符串格式验证函数。
|
||||
### <span id="Validator">24. validator 验证器包,包含常用字符串格式验证函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/validator"
|
||||
@@ -1673,7 +1702,7 @@ import "github.com/duke-git/lancet/v2/validator"
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/validator_zh-CN.md#IsPrintable)]
|
||||
[[play](https://go.dev/play/p/Pe1FE2gdtTP)]
|
||||
|
||||
### 25. xerror 包实现一些错误处理函数
|
||||
### <span id="Xerror">25. xerror 包实现一些错误处理函数。</span> [回到目录](#index)
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/xerror"
|
||||
|
||||
Reference in New Issue
Block a user