From 22316061d80271532574248d39e20b04ec5389d5 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Sat, 24 Oct 2026 23:03:48 +0800 Subject: [PATCH] release v2.4.0 --- README.md | 4334 +++++++++++++++++++++++----------------------- README_zh-CN.md | 4352 +++++++++++++++++++++++------------------------ 2 files changed, 4343 insertions(+), 4343 deletions(-) diff --git a/README.md b/README.md index ec80f9a..d2ffa9c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
![Go version](https://img.shields.io/badge/go-%3E%3Dv1.18-9cf) -[![Release](https://img.shields.io/badge/release-2.3.9-green.svg)](https://github.com/duke-git/lancet/releases) +[![Release](https://img.shields.io/badge/release-2.4.0-green.svg)](https://github.com/duke-git/lancet/releases) [![GoDoc](https://godoc.org/github.com/duke-git/lancet/v2?status.svg)](https://pkg.go.dev/github.com/duke-git/lancet/v2) [![Go Report Card](https://goreportcard.com/badge/github.com/duke-git/lancet/v2)](https://goreportcard.com/report/github.com/duke-git/lancet/v2) [![test](https://github.com/duke-git/lancet/actions/workflows/codecov.yml/badge.svg?branch=main&event=push)](https://github.com/duke-git/lancet/actions/workflows/codecov.yml) @@ -24,10 +24,10 @@ ## Features -- 👏 Comprehensive, efficient and reusable. -- 💪 700+ go util functions, support string, slice, datetime, net, crypt... -- 💅 Only depends on two kinds of libraries: go standard library and golang.org/x. -- 🌍 Unit test for every exported function. +- 👏 Comprehensive, efficient and reusable. +- 💪 700+ go util functions, support string, slice, datetime, net, crypt... +- 💅 Only depends on two kinds of libraries: go standard library and golang.org/x. +- 🌍 Unit test for every exported function. ## Installation @@ -76,33 +76,33 @@ func main() { ### Index -- [Algorithm](#user-content-algorithm) -- [Compare](#user-content-compare) -- [Concurrency](#user-content-concurrency) -- [Condition](#user-content-condition) -- [Convertor](#user-content-convertor) -- [Cryptor](#user-content-cryptor) -- [Datetime](#user-content-datetime) -- [Datastructure](#user-content-datastructure) -- [EventBus](#user-content-eventbus) -- [Enum](#user-content-enum) -- [Fileutil](#user-content-fileutil) -- [Formatter](#user-content-formatter) -- [Function](#user-content-function) -- [Maputil](#user-content-maputil) -- [Mathutil](#user-content-mathutil) -- [Netutil](#user-content-netutil) -- [Pointer](#user-content-pointer) -- [Random](#user-content-random) -- [Retry](#user-content-retry) -- [Slice](#user-content-slice) -- [Stream](#user-content-stream) -- [Structs](#user-content-structs) -- [Strutil](#user-content-strutil) -- [System](#user-content-system) -- [Tuple](#user-content-tuple) -- [Validator](#user-content-validator) -- [Xerror](#user-content-xerror) +- [Algorithm](#user-content-algorithm) +- [Compare](#user-content-compare) +- [Concurrency](#user-content-concurrency) +- [Condition](#user-content-condition) +- [Convertor](#user-content-convertor) +- [Cryptor](#user-content-cryptor) +- [Datetime](#user-content-datetime) +- [Datastructure](#user-content-datastructure) +- [EventBus](#user-content-eventbus) +- [Enum](#user-content-enum) +- [Fileutil](#user-content-fileutil) +- [Formatter](#user-content-formatter) +- [Function](#user-content-function) +- [Maputil](#user-content-maputil) +- [Mathutil](#user-content-mathutil) +- [Netutil](#user-content-netutil) +- [Pointer](#user-content-pointer) +- [Random](#user-content-random) +- [Retry](#user-content-retry) +- [Slice](#user-content-slice) +- [Stream](#user-content-stream) +- [Structs](#user-content-structs) +- [Strutil](#user-content-strutil) +- [System](#user-content-system) +- [Tuple](#user-content-tuple) +- [Validator](#user-content-validator) +- [Xerror](#user-content-xerror)

1. Algorithm package implements some basic algorithm. eg. sort, search.        index

@@ -112,42 +112,42 @@ import "github.com/duke-git/lancet/v2/algorithm" #### Function list: -- **BubbleSort** : sorts slice with bubble sort algorithm, will change the original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BubbleSort)] - [[play](https://go.dev/play/p/GNdv7Jg2Taj)] -- **CountSort** : sorts slice with bubble sort algorithm, don't change original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#CountSort)] - [[play](https://go.dev/play/p/tB-Umgm0DrP)] -- **HeapSort** : sorts slice with heap sort algorithm, will change the original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#HeapSort)] - [[play](https://go.dev/play/p/u6Iwa1VZS_f)] -- **InsertionSort** : sorts slice with insertion sort algorithm, will change the original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#InsertionSort)] - [[play](https://go.dev/play/p/G5LJiWgJJW6)] -- **MergeSort** : sorts slice with merge sort algorithm, will change the original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#MergeSort)] - [[play](https://go.dev/play/p/ydinn9YzUJn)] -- **QuickSort** : sorts slice with quick sort algorithm, will change the original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#QuickSort)] - [[play](https://go.dev/play/p/7Y7c1Elk3ax)] -- **SelectionSort** : sorts slice with selection sort algorithm, will change the original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#SelectionSort)] - [[play](https://go.dev/play/p/oXovbkekayS)] -- **ShellSort** : sorts slice with shell sort algorithm, will change the original slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#ShellSort)] - [[play](https://go.dev/play/p/3ibkszpJEu3)] -- **BinarySearch** : returns the index of target within a sorted slice, use binary search (recursive call itself). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BinarySearch)] - [[play](https://go.dev/play/p/t6MeGiUSN47)] -- **BinaryIterativeSearch** : returns the index of target within a sorted slice, use binary search (no recursive). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BinaryIterativeSearch)] - [[play](https://go.dev/play/p/Anozfr8ZLH3)] -- **LinearSearch** : returns the index of target in slice base on equal function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#LinearSearch)] - [[play](https://go.dev/play/p/IsS7rgn5s3x)] -- **LRUCache** : implements memory cache with lru algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#LRUCache)] - [[play](https://go.dev/play/p/-EZjgOURufP)] +- **BubbleSort** : sorts slice with bubble sort algorithm, will change the original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BubbleSort)] + [[play](https://go.dev/play/p/GNdv7Jg2Taj)] +- **CountSort** : sorts slice with bubble sort algorithm, don't change original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#CountSort)] + [[play](https://go.dev/play/p/tB-Umgm0DrP)] +- **HeapSort** : sorts slice with heap sort algorithm, will change the original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#HeapSort)] + [[play](https://go.dev/play/p/u6Iwa1VZS_f)] +- **InsertionSort** : sorts slice with insertion sort algorithm, will change the original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#InsertionSort)] + [[play](https://go.dev/play/p/G5LJiWgJJW6)] +- **MergeSort** : sorts slice with merge sort algorithm, will change the original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#MergeSort)] + [[play](https://go.dev/play/p/ydinn9YzUJn)] +- **QuickSort** : sorts slice with quick sort algorithm, will change the original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#QuickSort)] + [[play](https://go.dev/play/p/7Y7c1Elk3ax)] +- **SelectionSort** : sorts slice with selection sort algorithm, will change the original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#SelectionSort)] + [[play](https://go.dev/play/p/oXovbkekayS)] +- **ShellSort** : sorts slice with shell sort algorithm, will change the original slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#ShellSort)] + [[play](https://go.dev/play/p/3ibkszpJEu3)] +- **BinarySearch** : returns the index of target within a sorted slice, use binary search (recursive call itself). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BinarySearch)] + [[play](https://go.dev/play/p/t6MeGiUSN47)] +- **BinaryIterativeSearch** : returns the index of target within a sorted slice, use binary search (no recursive). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BinaryIterativeSearch)] + [[play](https://go.dev/play/p/Anozfr8ZLH3)] +- **LinearSearch** : returns the index of target in slice base on equal function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#LinearSearch)] + [[play](https://go.dev/play/p/IsS7rgn5s3x)] +- **LRUCache** : implements memory cache with lru algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#LRUCache)] + [[play](https://go.dev/play/p/-EZjgOURufP)]

2. Compare package provides a lightweight comparison function on any type.        index

@@ -157,26 +157,26 @@ import "github.com/duke-git/lancet/v2/compare" #### Function list: -- **Equal** : Checks if two values are equal or not. (check both type and value) - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#Equal)] - [[play](https://go.dev/play/p/wmVxR-to4lz)] -- **EqualValue** : Checks if two values are equal or not. (check value only) - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#EqualValue)] - [[play](https://go.dev/play/p/fxnna_LLD9u)] -- **LessThan** : Checks if value `left` less than value `right`. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#LessThan)] - [[play](https://go.dev/play/p/cYh7FQQj0ne)] -- **GreaterThan** : Checks if value `left` greater than value `right`. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#GreaterThan)] - [[play](https://go.dev/play/p/9-NYDFZmIMp)] -- **LessOrEqual** : Checks if value `left` less than or equal than value `right`. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#LessOrEqual)] - [[play](https://go.dev/play/p/e4T_scwoQzp)] -- **GreaterOrEqual** : Checks if value `left` less greater or equal than value `right`. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#GreaterOrEqual)] - [[play](https://go.dev/play/p/vx8mP0U8DFk)] -- **InDelta** : Checks if two values are equal or not within a delta. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#InDelta)] +- **Equal** : Checks if two values are equal or not. (check both type and value) + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#Equal)] + [[play](https://go.dev/play/p/wmVxR-to4lz)] +- **EqualValue** : Checks if two values are equal or not. (check value only) + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#EqualValue)] + [[play](https://go.dev/play/p/fxnna_LLD9u)] +- **LessThan** : Checks if value `left` less than value `right`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#LessThan)] + [[play](https://go.dev/play/p/cYh7FQQj0ne)] +- **GreaterThan** : Checks if value `left` greater than value `right`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#GreaterThan)] + [[play](https://go.dev/play/p/9-NYDFZmIMp)] +- **LessOrEqual** : Checks if value `left` less than or equal than value `right`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#LessOrEqual)] + [[play](https://go.dev/play/p/e4T_scwoQzp)] +- **GreaterOrEqual** : Checks if value `left` less greater or equal than value `right`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#GreaterOrEqual)] + [[play](https://go.dev/play/p/vx8mP0U8DFk)] +- **InDelta** : Checks if two values are equal or not within a delta. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#InDelta)]

3. Concurrency package contain some functions to support concurrent programming. eg, goroutine, channel, async.        index

@@ -186,60 +186,60 @@ import "github.com/duke-git/lancet/v2/concurrency" #### Function list: -- **NewChannel** : create a Channel pointer instance. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewChannel)] - [[play](https://go.dev/play/p/7aB4KyMMp9A)] -- **Bridge** : link multiply channels into one channel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/Bridge.md#NewChannel)] - [[play](https://go.dev/play/p/qmWSy1NVF-Y)] -- **FanIn** : merge multiple channels into one channel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#FanIn)] - [[play](https://go.dev/play/p/2VYFMexEvTm)] -- **Generate** : creates a channel, then put values into the channel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Generate)] - [[play](https://go.dev/play/p/7aB4KyMMp9A)] -- **Or** : read one or more channels into one channel, will close when any readin channel is closed. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Or)] - [[play](https://go.dev/play/p/Wqz9rwioPww)] -- **OrDone** : read a channel into another channel, will close until cancel context. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#OrDone)] - [[play](https://go.dev/play/p/lm_GoS6aDjo)] -- **Repeat** : create channel, put values into the channel repeatedly until cancel the context. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Repeat)] - [[play](https://go.dev/play/p/k5N_ALVmYjE)] -- **RepeatFn** : create a channel, executes fn repeatedly, and put the result into the channel, until close context. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#RepeatFn)] - [[play](https://go.dev/play/p/4J1zAWttP85)] -- **Take** : create a channel whose values are taken from another channel with limit number. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Take)] - [[play](https://go.dev/play/p/9Utt-1pDr2J)] -- **Tee** : split one chanel into two channels, until cancel the context. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Tee)] - [[play](https://go.dev/play/p/3TQPKnCirrP)] -- **NewKeyedLocker** : KeyedLocker is a simple implementation of a keyed locker that allows for non-blocking lock acquisition. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewKeyedLocker)] - [[play](https://go.dev/play/p/GzeyC33T5rw)] -- **Do** :acquires a lock for the specified key and executes the provided function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Do)] - [[play](https://go.dev/play/p/GzeyC33T5rw)] -- **NewRWKeyedLocker** :RRWKeyedLocker is a read-write version of KeyedLocker. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewRWKeyedLocker)] - [[play](https://go.dev/play/p/ZrCr8sMo77T)] -- **RLock** : acquires a read lock for the specified key and executes the provided function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#RLock)] - [[play](https://go.dev/play/p/ZrCr8sMo77T)] -- **Lock** : acquires a write lock for the specified key and executes the provided function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Lock)] - [[play](https://go.dev/play/p/WgAcXbOPKGk)] -- **NewTryKeyedLocker** : TryKeyedLocker is a non-blocking version of KeyedLocker. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewTryKeyedLocker)] - [[play](https://go.dev/play/p/VG9qLvyetE2)] -- **TryLock** : TryLock tries to acquire a lock for the specified key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#TryLock)] - [[play](https://go.dev/play/p/VG9qLvyetE2)] -- **Unlock** : Unlock releases the lock for the specified key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Unlock)] - [[play](https://go.dev/play/p/VG9qLvyetE2)] +- **NewChannel** : create a Channel pointer instance. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewChannel)] + [[play](https://go.dev/play/p/7aB4KyMMp9A)] +- **Bridge** : link multiply channels into one channel. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/Bridge.md#NewChannel)] + [[play](https://go.dev/play/p/qmWSy1NVF-Y)] +- **FanIn** : merge multiple channels into one channel. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#FanIn)] + [[play](https://go.dev/play/p/2VYFMexEvTm)] +- **Generate** : creates a channel, then put values into the channel. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Generate)] + [[play](https://go.dev/play/p/7aB4KyMMp9A)] +- **Or** : read one or more channels into one channel, will close when any readin channel is closed. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Or)] + [[play](https://go.dev/play/p/Wqz9rwioPww)] +- **OrDone** : read a channel into another channel, will close until cancel context. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#OrDone)] + [[play](https://go.dev/play/p/lm_GoS6aDjo)] +- **Repeat** : create channel, put values into the channel repeatedly until cancel the context. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Repeat)] + [[play](https://go.dev/play/p/k5N_ALVmYjE)] +- **RepeatFn** : create a channel, executes fn repeatedly, and put the result into the channel, until close context. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#RepeatFn)] + [[play](https://go.dev/play/p/4J1zAWttP85)] +- **Take** : create a channel whose values are taken from another channel with limit number. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Take)] + [[play](https://go.dev/play/p/9Utt-1pDr2J)] +- **Tee** : split one chanel into two channels, until cancel the context. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Tee)] + [[play](https://go.dev/play/p/3TQPKnCirrP)] +- **NewKeyedLocker** : KeyedLocker is a simple implementation of a keyed locker that allows for non-blocking lock acquisition. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewKeyedLocker)] + [[play](https://go.dev/play/p/GzeyC33T5rw)] +- **Do** :acquires a lock for the specified key and executes the provided function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Do)] + [[play](https://go.dev/play/p/GzeyC33T5rw)] +- **NewRWKeyedLocker** :RRWKeyedLocker is a read-write version of KeyedLocker. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewRWKeyedLocker)] + [[play](https://go.dev/play/p/ZrCr8sMo77T)] +- **RLock** : acquires a read lock for the specified key and executes the provided function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#RLock)] + [[play](https://go.dev/play/p/ZrCr8sMo77T)] +- **Lock** : acquires a write lock for the specified key and executes the provided function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Lock)] + [[play](https://go.dev/play/p/WgAcXbOPKGk)] +- **NewTryKeyedLocker** : TryKeyedLocker is a non-blocking version of KeyedLocker. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewTryKeyedLocker)] + [[play](https://go.dev/play/p/VG9qLvyetE2)] +- **TryLock** : TryLock tries to acquire a lock for the specified key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#TryLock)] + [[play](https://go.dev/play/p/VG9qLvyetE2)] +- **Unlock** : Unlock releases the lock for the specified key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Unlock)] + [[play](https://go.dev/play/p/VG9qLvyetE2)]

4. Condition package contains some functions for conditional judgment. eg. And, Or, TernaryOperator...       index

@@ -249,30 +249,30 @@ import "github.com/duke-git/lancet/v2/condition" #### Function list: -- **Bool** : returns the truthy value of anything. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Bool)] - [[play](https://go.dev/play/p/ETzeDJRSvhm)] -- **And** : returns true if both a and b are truthy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#And)] - [[play](https://go.dev/play/p/W1SSUmt6pvr)] -- **Or** : returns false if neither a nor b is truthy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Or)] - [[play](https://go.dev/play/p/UlQTxHaeEkq)] -- **Xor** : returns true if a or b but not both is truthy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Xor)] - [[play](https://go.dev/play/p/gObZrW7ZbG8)] -- **Nor** : returns true if neither a nor b is truthy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Nor)] - [[play](https://go.dev/play/p/g2j08F_zZky)] -- **Xnor** : returns true if both a and b or neither a nor b are truthy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Xnor)] - [[play](https://go.dev/play/p/OuDB9g51643)] -- **Nand** : returns false if both a and b are truthy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Nand)] - [[play](https://go.dev/play/p/vSRMLxLIbq8)] -- **TernaryOperator** : ternary operator. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#TernaryOperator)] - [[play](https://go.dev/play/p/ElllPZY0guT)] +- **Bool** : returns the truthy value of anything. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Bool)] + [[play](https://go.dev/play/p/ETzeDJRSvhm)] +- **And** : returns true if both a and b are truthy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#And)] + [[play](https://go.dev/play/p/W1SSUmt6pvr)] +- **Or** : returns false if neither a nor b is truthy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Or)] + [[play](https://go.dev/play/p/UlQTxHaeEkq)] +- **Xor** : returns true if a or b but not both is truthy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Xor)] + [[play](https://go.dev/play/p/gObZrW7ZbG8)] +- **Nor** : returns true if neither a nor b is truthy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Nor)] + [[play](https://go.dev/play/p/g2j08F_zZky)] +- **Xnor** : returns true if both a and b or neither a nor b are truthy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Xnor)] + [[play](https://go.dev/play/p/OuDB9g51643)] +- **Nand** : returns false if both a and b are truthy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Nand)] + [[play](https://go.dev/play/p/vSRMLxLIbq8)] +- **TernaryOperator** : ternary operator. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#TernaryOperator)] + [[play](https://go.dev/play/p/ElllPZY0guT)]

5. Convertor package contains some functions for data conversion.        index

@@ -282,93 +282,93 @@ import "github.com/duke-git/lancet/v2/convertor" #### Function list: -- **ColorHexToRGB** : convert color hex to color rgb. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ColorHexToRGB)] - [[play](https://go.dev/play/p/o7_ft-JCJBV)] -- **ColorRGBToHex** : convert rgb color to hex color. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ColorRGBToHex)] - [[play](https://go.dev/play/p/nzKS2Ro87J1)] -- **ToBool** : convert string to bool. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBool)] - [[play](https://go.dev/play/p/ARht2WnGdIN)] -- **ToBytes** : convert value to byte slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBytes)] - [[play](https://go.dev/play/p/fAMXYFDvOvr)] -- **ToChar** : convert string to char slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToChar)] - [[play](https://go.dev/play/p/JJ1SvbFkVdM)] -- **ToChannel** : convert a collection of elements to a read-only channel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToChannel)] - [[play](https://go.dev/play/p/hOx_oYZbAnL)] -- **ToFloat** : convert value to float64, if param is a invalid floatable, will return 0.0 and error. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToFloat)] - [[play](https://go.dev/play/p/4YTmPCibqHJ)] -- **ToInt** : convert value to int64 value, if input is not numerical, return 0 and error. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToInt)] - [[play](https://go.dev/play/p/9_h9vIt-QZ_b)] -- **ToJson** : convert value to a json string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToJson)] - [[play](https://go.dev/play/p/2rLIkMmXWvR)] -- **ToMap** : convert a slice of structs to a map based on iteratee function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToMap)] - [[play](https://go.dev/play/p/tVFy7E-t24l)] -- **ToPointer** : return a pointer of passed value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToPointer)] - [[play](https://go.dev/play/p/ASf_etHNlw1)] -- **ToPointers** : convert a slice of values to a slice of pointers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToPointers)] - [[play](https://go.dev/play/p/ZUoXd2i5ZkV)] -- **FromPointer** : returns the value pointed to by the pointer. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#FromPointer)] - [[play](https://go.dev/play/p/wAp90V7Zu6g)] -- **FromPointers** : convert a slice of pointers to a slice of values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#FromPointers)] - [[play](https://go.dev/play/p/qIPsyYtNy3Q)] -- **ToString** : convert value to string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToString)] - [[play](https://go.dev/play/p/nF1zOOslpQq)] -- **StructToMap** : convert struct to map, only convert exported struct field. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#StructToMap)] - [[play](https://go.dev/play/p/KYGYJqNUBOI)] -- **MapToSlice** : convert map to slice based on iteratee function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#MapToSlice)] - [[play](https://go.dev/play/p/dmX4Ix5V6Wl)] -- **EncodeByte** : encode data to byte slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#EncodeByte)] - [[play](https://go.dev/play/p/DVmM1G5JfuP)] -- **DecodeByte** : decode byte slice data to target object. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#DecodeByte)] - [[play](https://go.dev/play/p/zI6xsmuQRbn)] -- **DeepClone** : creates a deep copy of passed item, can't clone unexported field of struct. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#DeepClone)] - [[play](https://go.dev/play/p/j4DP5dquxnk)] -- **CopyProperties** : copies each field from the source struct into the destination struct. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#CopyProperties)] - [[play](https://go.dev/play/p/oZujoB5Sgg5)] -- **ToInterface** : converts reflect value to its interface type. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToInterface)] - [[play](https://go.dev/play/p/syqw0-WG7Xd)] -- **Utf8ToGbk** : converts utf8 encoding data to GBK encoding data - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#Utf8ToGbk)] - [[play](https://go.dev/play/p/9FlIaFLArIL)] -- **GbkToUtf8** : converts GBK encoding data to utf8 encoding data. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#GbkToUtf8)] - [[play](https://go.dev/play/p/OphmHCN_9u8)] -- **ToStdBase64** : converts a value to a string encoded in standard Base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToStdBase64)] - [[play](https://go.dev/play/p/_fLJqJD3NMo)] -- **ToUrlBase64** : converts a value to a string encoded in url Base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToUrlBase64)] - [[play](https://go.dev/play/p/C_d0GlvEeUR)] -- **ToRawStdBase64** : converts a value to a string encoded in raw standard Base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToRawStdBase64)] - [[play](https://go.dev/play/p/wSAr3sfkDcv)] -- **ToRawUrlBase64** : converts a value to a string encoded in raw url Base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToRawUrlBase64)] - [[play](https://go.dev/play/p/HwdDPFcza1O)] -- **ToBigInt** : converts an integer of any supported type (int, int64, uint64, etc.) to \*big.Int. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBigInt)] - [[play](https://go.dev/play/p/X3itkCxwB_x)] +- **ColorHexToRGB** : convert color hex to color rgb. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ColorHexToRGB)] + [[play](https://go.dev/play/p/o7_ft-JCJBV)] +- **ColorRGBToHex** : convert rgb color to hex color. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ColorRGBToHex)] + [[play](https://go.dev/play/p/nzKS2Ro87J1)] +- **ToBool** : convert string to bool. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBool)] + [[play](https://go.dev/play/p/ARht2WnGdIN)] +- **ToBytes** : convert value to byte slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBytes)] + [[play](https://go.dev/play/p/fAMXYFDvOvr)] +- **ToChar** : convert string to char slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToChar)] + [[play](https://go.dev/play/p/JJ1SvbFkVdM)] +- **ToChannel** : convert a collection of elements to a read-only channel. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToChannel)] + [[play](https://go.dev/play/p/hOx_oYZbAnL)] +- **ToFloat** : convert value to float64, if param is a invalid floatable, will return 0.0 and error. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToFloat)] + [[play](https://go.dev/play/p/4YTmPCibqHJ)] +- **ToInt** : convert value to int64 value, if input is not numerical, return 0 and error. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToInt)] + [[play](https://go.dev/play/p/9_h9vIt-QZ_b)] +- **ToJson** : convert value to a json string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToJson)] + [[play](https://go.dev/play/p/2rLIkMmXWvR)] +- **ToMap** : convert a slice of structs to a map based on iteratee function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToMap)] + [[play](https://go.dev/play/p/tVFy7E-t24l)] +- **ToPointer** : return a pointer of passed value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToPointer)] + [[play](https://go.dev/play/p/ASf_etHNlw1)] +- **ToPointers** : convert a slice of values to a slice of pointers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToPointers)] + [[play](https://go.dev/play/p/ZUoXd2i5ZkV)] +- **FromPointer** : returns the value pointed to by the pointer. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#FromPointer)] + [[play](https://go.dev/play/p/wAp90V7Zu6g)] +- **FromPointers** : convert a slice of pointers to a slice of values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#FromPointers)] + [[play](https://go.dev/play/p/qIPsyYtNy3Q)] +- **ToString** : convert value to string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToString)] + [[play](https://go.dev/play/p/nF1zOOslpQq)] +- **StructToMap** : convert struct to map, only convert exported struct field. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#StructToMap)] + [[play](https://go.dev/play/p/KYGYJqNUBOI)] +- **MapToSlice** : convert map to slice based on iteratee function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#MapToSlice)] + [[play](https://go.dev/play/p/dmX4Ix5V6Wl)] +- **EncodeByte** : encode data to byte slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#EncodeByte)] + [[play](https://go.dev/play/p/DVmM1G5JfuP)] +- **DecodeByte** : decode byte slice data to target object. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#DecodeByte)] + [[play](https://go.dev/play/p/zI6xsmuQRbn)] +- **DeepClone** : creates a deep copy of passed item, can't clone unexported field of struct. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#DeepClone)] + [[play](https://go.dev/play/p/j4DP5dquxnk)] +- **CopyProperties** : copies each field from the source struct into the destination struct. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#CopyProperties)] + [[play](https://go.dev/play/p/oZujoB5Sgg5)] +- **ToInterface** : converts reflect value to its interface type. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToInterface)] + [[play](https://go.dev/play/p/syqw0-WG7Xd)] +- **Utf8ToGbk** : converts utf8 encoding data to GBK encoding data + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#Utf8ToGbk)] + [[play](https://go.dev/play/p/9FlIaFLArIL)] +- **GbkToUtf8** : converts GBK encoding data to utf8 encoding data. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#GbkToUtf8)] + [[play](https://go.dev/play/p/OphmHCN_9u8)] +- **ToStdBase64** : converts a value to a string encoded in standard Base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToStdBase64)] + [[play](https://go.dev/play/p/_fLJqJD3NMo)] +- **ToUrlBase64** : converts a value to a string encoded in url Base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToUrlBase64)] + [[play](https://go.dev/play/p/C_d0GlvEeUR)] +- **ToRawStdBase64** : converts a value to a string encoded in raw standard Base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToRawStdBase64)] + [[play](https://go.dev/play/p/wSAr3sfkDcv)] +- **ToRawUrlBase64** : converts a value to a string encoded in raw url Base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToRawUrlBase64)] + [[play](https://go.dev/play/p/HwdDPFcza1O)] +- **ToBigInt** : converts an integer of any supported type (int, int64, uint64, etc.) to \*big.Int. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBigInt)] + [[play](https://go.dev/play/p/X3itkCxwB_x)]

6. Cryptor package is for data encryption and decryption.       index

@@ -378,175 +378,175 @@ import "github.com/duke-git/lancet/v2/cryptor" #### Function list: -- **AesEcbEncrypt** : encrypt byte slice data with key use AES ECB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesEcbEncrypt)] - [[play](https://go.dev/play/p/zI6xsmuQRbn)] -- **AesEcbDecrypt** : decrypt byte slice data with key use AES ECB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesEcbDecrypt)] - [[play](https://go.dev/play/p/zI6xsmuQRbn)] -- **AesCbcEncrypt** : encrypt byte slice data with key use AES CBC algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCbcEncrypt)] - [[play](https://go.dev/play/p/IOq_g8_lKZD)] -- **AesCbcDecrypt** : decrypt byte slice data with key use AES CBC algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCbcDecrypt)] - [[play](https://go.dev/play/p/IOq_g8_lKZD)] -- **AesCtrCrypt** : encrypt/ decrypt byte slice data with key use AES CRC algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCtrCrypt)] - [[play](https://go.dev/play/p/SpaZO0-5Nsp)] -- **AesCfbEncrypt** : encrypt byte slice data with key use AES CFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCfbEncrypt)] - [[play](https://go.dev/play/p/tfkF10B13kH)] -- **AesCfbDecrypt** : decrypt byte slice data with key use AES CFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCfbDecrypt)] - [[play](https://go.dev/play/p/tfkF10B13kH)] -- **AesOfbEncrypt** : encrypt byte slice data with key use AES OFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesOfbEncrypt)] - [[play](https://go.dev/play/p/VtHxtkUj-3F)] -- **AesOfbDecrypt** : decrypt byte slice data with key use AES OFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesOfbDecrypt)] - [[play](https://go.dev/play/p/VtHxtkUj-3F)] -- **AesGcmEncrypt** : encrypt byte slice data with key use AES GCM algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesGcmEncrypt)] - [[play](https://go.dev/play/p/rUt0-DmsPCs)] -- **AesGcmDecrypt** : decrypt byte slice data with key use AES GCM algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesGcmDecrypt)] - [[play](https://go.dev/play/p/rUt0-DmsPCs)] -- **Base64StdEncode** : encode string with base64 encoding. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Base64StdEncode)] - [[play](https://go.dev/play/p/VOaUyQUreoK)] -- **Base64StdDecode** : decode string with base64 encoding. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Base64StdDecode)] - [[play](https://go.dev/play/p/RWQylnJVgIe)] -- **DesEcbEncrypt** : encrypt byte slice data with key use DES ECB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesEcbEncrypt)] - [[play](https://go.dev/play/p/8qivmPeZy4P)] -- **DesEcbDecrypt** : decrypt byte slice data with key use DES ECB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesEcbDecrypt)] - [[play](https://go.dev/play/p/8qivmPeZy4P)] -- **DesCbcEncrypt** : encrypt byte slice data with key use DES CBC algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCbcEncrypt)] - [[play](https://go.dev/play/p/4cC4QvWfe3_1)] -- **DesCbcDecrypt** : decrypt byte slice data with key use DES CBC algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCbcDecrypt)] - [[play](https://go.dev/play/p/4cC4QvWfe3_1)] -- **DesCtrCrypt** : encrypt/decrypt byte slice data with key use DES CRY algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCtrCrypt)] - [[play](https://go.dev/play/p/9-T6OjKpcdw)] -- **DesCfbEncrypt** : encrypt byte slice data with key use DES CFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCfbEncrypt)] - [[play](https://go.dev/play/p/y-eNxcFBlxL)] -- **DesCfbDecrypt** : decrypt byte slice data with key use DES CFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCfbDecrypt)] - [[play](https://go.dev/play/p/y-eNxcFBlxL)] -- **DesOfbEncrypt** : encrypt byte slice data with key use DES OFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesOfbEncrypt)] - [[play](https://go.dev/play/p/74KmNadjN1J)] -- **DesOfbDecrypt** : decrypt byte slice data with key use DES OFB algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesOfbDecrypt)] - [[play](https://go.dev/play/p/74KmNadjN1J)] -- **HmacMd5** : return the md5 hmac hash of string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacMd5)] - [[play](https://go.dev/play/p/uef0q1fz53I)] -- **HmacMd5WithBase64** : return the md5 hmac hash of base64 string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacMd5WithBase64)] -- **HmacSha1** : return the hmac hash of string use sha1. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha1)] - [[play](https://go.dev/play/p/1UI4oQ4WXKM)] -- **HmacSha1WithBase64** : return the hmac hash of string use sha1 with base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha1WithBase64)] - [[play](https://go.dev/play/p/47JmmGrnF7B)] -- **HmacSha256** : return the hmac hash of string use sha256. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha256)] - [[play](https://go.dev/play/p/HhpwXxFhhC0)] -- **HmacSha256WithBase64** : return the hmac hash of string use sha256 with base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha256WithBase64)] - [[play](https://go.dev/play/p/EKbkUvPTLwO)] -- **HmacSha512** : return the hmac hash of string use sha512. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha512)] - [[play](https://go.dev/play/p/59Od6m4A0Ud)] -- **HmacSha512WithBase64** : return the hmac hash of string use sha512 with base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha512WithBase64)] - [[play](https://go.dev/play/p/c6dSe3E2ydU)] -- **Md5Byte** : return the md5 string of byte slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5Byte)] - [[play](https://go.dev/play/p/suraalH8lyC)] -- **Md5ByteWithBase64** : return the md5 string of byte slice with base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5ByteWithBase64)] - [[play](https://go.dev/play/p/Tcb-Z7LN2ax)] -- **Md5String** : return the md5 value of string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5String)] - [[play](https://go.dev/play/p/1bLcVetbTOI)] -- **Md5StringWithBase64** : return the md5 value of string with base64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5StringWithBase64)] - [[play](https://go.dev/play/p/Lx4gH7Vdr5_y)] -- **Md5File** : return the md5 value of file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5File)] -- **Sha1** : return the sha1 value (SHA-1 hash algorithm) of base64 string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha1)] - [[play](https://go.dev/play/p/_m_uoD1deMT)] -- **Sha1WithBase64** : return the sha1 value (SHA-1 hash algorithm) of string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha1WithBase64)] - [[play](https://go.dev/play/p/fSyx-Gl2l2-)] -- **Sha256** : return the sha256 value (SHA-256 hash algorithm) of string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha256)] - [[play](https://go.dev/play/p/tU9tfBMIAr1)] -- **Sha256WithBase64** : return the sha256 value (SHA256 hash algorithm) of base64 string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha256WithBase64)] - [[play](https://go.dev/play/p/85IXJHIal1k)] -- **Sha512** : return the sha512 value (SHA-512 hash algorithm) of string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha512)] - [[play](https://go.dev/play/p/3WsvLYZxsHa)] -- **Sha512WithBase64** : return the sha512 value (SHA-512 hash algorithm) of base64 string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha512WithBase64)] - [[play](https://go.dev/play/p/q_fY2rA-k5I)] -- **GenerateRsaKey** : create rsa private and public pemo file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateRsaKey)] - [[play](https://go.dev/play/p/zutRHrDqs0X)] -- **RsaEncrypt** : encrypt data with ras algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaEncrypt)] - [[play](https://go.dev/play/p/7_zo6mrx-eX)] -- **RsaDecrypt** : decrypt data with ras algorithm. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaDecrypt)] - [[play](https://go.dev/play/p/7_zo6mrx-eX)] -- **GenerateRsaKeyPair** : creates rsa private and public key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateRsaKeyPair)] - [[play](https://go.dev/play/p/sSVmkfENKMz)] -- **RsaEncryptOAEP** : encrypts the given data with RSA-OAEP. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaEncryptOAEP)] - [[play](https://go.dev/play/p/sSVmkfENKMz)] -- **RsaDecryptOAEP** : decrypts the data with RSA-OAEP - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaDecryptOAEP)] - [[play](https://go.dev/play/p/sSVmkfENKMz)] -- **RsaSign** : signs the data with RSA. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaSign)] - [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] -- **RsaVerifySign** : verifies the signature of the data with RSA. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaVerifySign)] - [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] -- **GenerateSm2Key** : generate SM2 private and public key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateSm2Key)] - [[play](https://go.dev/play/p/bKYMqRLvIx3)] -- **Sm2Encrypt** : encrypt data with SM2 public key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm2Encrypt)] - [[play](https://go.dev/play/p/bKYMqRLvIx3)] -- **Sm2Decrypt** : decrypt data with SM2 private key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm2Decrypt)] - [[play](https://go.dev/play/p/bKYMqRLvIx3)] -- **Sm3** : return the SM3 hash value (256-bit) of data. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm3)] - [[play](https://go.dev/play/p/zDAQpteAiOc)] -- **Sm4EcbEncrypt** : encrypt data with SM4 ECB mode. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4EcbEncrypt)] - [[play](https://go.dev/play/p/l5IQxYuuaED)] -- **Sm4EcbDecrypt** : decrypt data with SM4 ECB mode. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4EcbDecrypt)] - [[play](https://go.dev/play/p/l5IQxYuuaED)] -- **Sm4CbcEncrypt** : encrypt data with SM4 CBC mode. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4CbcEncrypt)] - [[play](https://go.dev/play/p/65Q6iYhLRTa)] -- **Sm4CbcDecrypt** : decrypt data with SM4 CBC mode. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4CbcDecrypt)] - [[play](https://go.dev/play/p/65Q6iYhLRTa)] +- **AesEcbEncrypt** : encrypt byte slice data with key use AES ECB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesEcbEncrypt)] + [[play](https://go.dev/play/p/zI6xsmuQRbn)] +- **AesEcbDecrypt** : decrypt byte slice data with key use AES ECB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesEcbDecrypt)] + [[play](https://go.dev/play/p/zI6xsmuQRbn)] +- **AesCbcEncrypt** : encrypt byte slice data with key use AES CBC algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCbcEncrypt)] + [[play](https://go.dev/play/p/IOq_g8_lKZD)] +- **AesCbcDecrypt** : decrypt byte slice data with key use AES CBC algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCbcDecrypt)] + [[play](https://go.dev/play/p/IOq_g8_lKZD)] +- **AesCtrCrypt** : encrypt/ decrypt byte slice data with key use AES CRC algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCtrCrypt)] + [[play](https://go.dev/play/p/SpaZO0-5Nsp)] +- **AesCfbEncrypt** : encrypt byte slice data with key use AES CFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCfbEncrypt)] + [[play](https://go.dev/play/p/tfkF10B13kH)] +- **AesCfbDecrypt** : decrypt byte slice data with key use AES CFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCfbDecrypt)] + [[play](https://go.dev/play/p/tfkF10B13kH)] +- **AesOfbEncrypt** : encrypt byte slice data with key use AES OFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesOfbEncrypt)] + [[play](https://go.dev/play/p/VtHxtkUj-3F)] +- **AesOfbDecrypt** : decrypt byte slice data with key use AES OFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesOfbDecrypt)] + [[play](https://go.dev/play/p/VtHxtkUj-3F)] +- **AesGcmEncrypt** : encrypt byte slice data with key use AES GCM algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesGcmEncrypt)] + [[play](https://go.dev/play/p/rUt0-DmsPCs)] +- **AesGcmDecrypt** : decrypt byte slice data with key use AES GCM algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesGcmDecrypt)] + [[play](https://go.dev/play/p/rUt0-DmsPCs)] +- **Base64StdEncode** : encode string with base64 encoding. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Base64StdEncode)] + [[play](https://go.dev/play/p/VOaUyQUreoK)] +- **Base64StdDecode** : decode string with base64 encoding. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Base64StdDecode)] + [[play](https://go.dev/play/p/RWQylnJVgIe)] +- **DesEcbEncrypt** : encrypt byte slice data with key use DES ECB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesEcbEncrypt)] + [[play](https://go.dev/play/p/8qivmPeZy4P)] +- **DesEcbDecrypt** : decrypt byte slice data with key use DES ECB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesEcbDecrypt)] + [[play](https://go.dev/play/p/8qivmPeZy4P)] +- **DesCbcEncrypt** : encrypt byte slice data with key use DES CBC algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCbcEncrypt)] + [[play](https://go.dev/play/p/4cC4QvWfe3_1)] +- **DesCbcDecrypt** : decrypt byte slice data with key use DES CBC algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCbcDecrypt)] + [[play](https://go.dev/play/p/4cC4QvWfe3_1)] +- **DesCtrCrypt** : encrypt/decrypt byte slice data with key use DES CRY algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCtrCrypt)] + [[play](https://go.dev/play/p/9-T6OjKpcdw)] +- **DesCfbEncrypt** : encrypt byte slice data with key use DES CFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCfbEncrypt)] + [[play](https://go.dev/play/p/y-eNxcFBlxL)] +- **DesCfbDecrypt** : decrypt byte slice data with key use DES CFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCfbDecrypt)] + [[play](https://go.dev/play/p/y-eNxcFBlxL)] +- **DesOfbEncrypt** : encrypt byte slice data with key use DES OFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesOfbEncrypt)] + [[play](https://go.dev/play/p/74KmNadjN1J)] +- **DesOfbDecrypt** : decrypt byte slice data with key use DES OFB algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesOfbDecrypt)] + [[play](https://go.dev/play/p/74KmNadjN1J)] +- **HmacMd5** : return the md5 hmac hash of string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacMd5)] + [[play](https://go.dev/play/p/uef0q1fz53I)] +- **HmacMd5WithBase64** : return the md5 hmac hash of base64 string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacMd5WithBase64)] +- **HmacSha1** : return the hmac hash of string use sha1. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha1)] + [[play](https://go.dev/play/p/1UI4oQ4WXKM)] +- **HmacSha1WithBase64** : return the hmac hash of string use sha1 with base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha1WithBase64)] + [[play](https://go.dev/play/p/47JmmGrnF7B)] +- **HmacSha256** : return the hmac hash of string use sha256. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha256)] + [[play](https://go.dev/play/p/HhpwXxFhhC0)] +- **HmacSha256WithBase64** : return the hmac hash of string use sha256 with base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha256WithBase64)] + [[play](https://go.dev/play/p/EKbkUvPTLwO)] +- **HmacSha512** : return the hmac hash of string use sha512. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha512)] + [[play](https://go.dev/play/p/59Od6m4A0Ud)] +- **HmacSha512WithBase64** : return the hmac hash of string use sha512 with base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha512WithBase64)] + [[play](https://go.dev/play/p/c6dSe3E2ydU)] +- **Md5Byte** : return the md5 string of byte slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5Byte)] + [[play](https://go.dev/play/p/suraalH8lyC)] +- **Md5ByteWithBase64** : return the md5 string of byte slice with base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5ByteWithBase64)] + [[play](https://go.dev/play/p/Tcb-Z7LN2ax)] +- **Md5String** : return the md5 value of string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5String)] + [[play](https://go.dev/play/p/1bLcVetbTOI)] +- **Md5StringWithBase64** : return the md5 value of string with base64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5StringWithBase64)] + [[play](https://go.dev/play/p/Lx4gH7Vdr5_y)] +- **Md5File** : return the md5 value of file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5File)] +- **Sha1** : return the sha1 value (SHA-1 hash algorithm) of base64 string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha1)] + [[play](https://go.dev/play/p/_m_uoD1deMT)] +- **Sha1WithBase64** : return the sha1 value (SHA-1 hash algorithm) of string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha1WithBase64)] + [[play](https://go.dev/play/p/fSyx-Gl2l2-)] +- **Sha256** : return the sha256 value (SHA-256 hash algorithm) of string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha256)] + [[play](https://go.dev/play/p/tU9tfBMIAr1)] +- **Sha256WithBase64** : return the sha256 value (SHA256 hash algorithm) of base64 string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha256WithBase64)] + [[play](https://go.dev/play/p/85IXJHIal1k)] +- **Sha512** : return the sha512 value (SHA-512 hash algorithm) of string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha512)] + [[play](https://go.dev/play/p/3WsvLYZxsHa)] +- **Sha512WithBase64** : return the sha512 value (SHA-512 hash algorithm) of base64 string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha512WithBase64)] + [[play](https://go.dev/play/p/q_fY2rA-k5I)] +- **GenerateRsaKey** : create rsa private and public pemo file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateRsaKey)] + [[play](https://go.dev/play/p/zutRHrDqs0X)] +- **RsaEncrypt** : encrypt data with ras algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaEncrypt)] + [[play](https://go.dev/play/p/7_zo6mrx-eX)] +- **RsaDecrypt** : decrypt data with ras algorithm. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaDecrypt)] + [[play](https://go.dev/play/p/7_zo6mrx-eX)] +- **GenerateRsaKeyPair** : creates rsa private and public key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateRsaKeyPair)] + [[play](https://go.dev/play/p/sSVmkfENKMz)] +- **RsaEncryptOAEP** : encrypts the given data with RSA-OAEP. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaEncryptOAEP)] + [[play](https://go.dev/play/p/sSVmkfENKMz)] +- **RsaDecryptOAEP** : decrypts the data with RSA-OAEP + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaDecryptOAEP)] + [[play](https://go.dev/play/p/sSVmkfENKMz)] +- **RsaSign** : signs the data with RSA. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaSign)] + [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] +- **RsaVerifySign** : verifies the signature of the data with RSA. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaVerifySign)] + [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] +- **GenerateSm2Key** : generate SM2 private and public key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateSm2Key)] + [[play](https://go.dev/play/p/bKYMqRLvIx3)] +- **Sm2Encrypt** : encrypt data with SM2 public key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm2Encrypt)] + [[play](https://go.dev/play/p/bKYMqRLvIx3)] +- **Sm2Decrypt** : decrypt data with SM2 private key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm2Decrypt)] + [[play](https://go.dev/play/p/bKYMqRLvIx3)] +- **Sm3** : return the SM3 hash value (256-bit) of data. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm3)] + [[play](https://go.dev/play/p/zDAQpteAiOc)] +- **Sm4EcbEncrypt** : encrypt data with SM4 ECB mode. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4EcbEncrypt)] + [[play](https://go.dev/play/p/l5IQxYuuaED)] +- **Sm4EcbDecrypt** : decrypt data with SM4 ECB mode. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4EcbDecrypt)] + [[play](https://go.dev/play/p/l5IQxYuuaED)] +- **Sm4CbcEncrypt** : encrypt data with SM4 CBC mode. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4CbcEncrypt)] + [[play](https://go.dev/play/p/65Q6iYhLRTa)] +- **Sm4CbcDecrypt** : decrypt data with SM4 CBC mode. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sm4CbcDecrypt)] + [[play](https://go.dev/play/p/65Q6iYhLRTa)]

7. Datetime package supports date and time format and compare.        index

@@ -556,164 +556,164 @@ import "github.com/duke-git/lancet/v2/datetime" #### Function list: -- **AddDay** : add or sub day to the time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddDay)] - [[play](https://go.dev/play/p/dIGbs_uTdFa)] -- **AddHour** : add or sub day to the time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddHour)] - [[play](https://go.dev/play/p/rcMjd7OCsi5)] -- **AddMinute** : add or sub day to the time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddMinute)] - [[play](https://go.dev/play/p/nT1heB1KUUK)] -- **AddWeek** : add or sub week to time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddWeek)] - [[play](https://go.dev/play/p/M9TqdMiaA2p)] -- **AddMonth** : add or sub months to time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddMonth)] - [[play](https://go.dev/play/p/DLoiOnpLvsN)] -- **AddYear** : add or sub year to the time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddYear)] - [[play](https://go.dev/play/p/MqW2ujnBx10)] -- **AddDaySafe** : add or sub days to the time and ensure that the returned date does not exceed the valid date of the target year and month. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddDaySafe)] - [[play](https://go.dev/play/p/JTohZFpoDJ3)] -- **AddMonthSafe** : add or sub months to the time and ensure that the returned date does not exceed the valid date of the target year and month. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddMonthSafe)] - [[play](https://go.dev/play/p/KLw0lo6mbVW)] -- **AddYearSafe** : Add or sub years to the time and ensure that the returned date does not exceed the valid date of the target year and month. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddYearSafe)] - [[play](https://go.dev/play/p/KVGXWZZ54ZH)] -- **BeginOfMinute** : return the date time at the begin of minute of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfMinute)] - [[play](https://go.dev/play/p/ieOLVJ9CiFT)] -- **BeginOfHour** : return the date time at the begin of hour of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfHour)] - [[play](https://go.dev/play/p/GhdGFnDWpYs)] -- **BeginOfDay** : return the date time at the begin of day of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfDay)] - [[play](https://go.dev/play/p/94m_UT6cWs9)] -- **BeginOfWeek** : return the date time at the begin of week of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfWeek)] - [[play](https://go.dev/play/p/DCHdcL6gnfV)] -- **BeginOfMonth** : return the date time at the begin of month of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfMonth)] - [[play](https://go.dev/play/p/bWXVFsmmzwL)] -- **BeginOfYear** : return the date time at the begin of year of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfYear)] - [[play](https://go.dev/play/p/i326DSwLnV8)] -- **EndOfMinute** : return the date time at the end of minute of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfMinute)] - [[play](https://go.dev/play/p/yrL5wGzPj4z)] -- **EndOfHour** : return the date time at the end of hour of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfHour)] - [[play](https://go.dev/play/p/6ce3j_6cVqN)] -- **EndOfDay** : return the date time at the end of day of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfDay)] - [[play](https://go.dev/play/p/eMBOvmq5Ih1)] -- **EndOfWeek** : return the date time at the end of week of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfWeek)] - [[play](https://go.dev/play/p/mGSA162YgX9)] -- **EndOfMonth** : return the date time at the end of month of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfMonth)] - [[play](https://go.dev/play/p/_GWh10B3Nqi)] -- **EndOfYear** : return the date time at the end of year of specific date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfYear)] - [[play](https://go.dev/play/p/G01cKlMCvNm)] -- **GetNowDate** : return format yyyy-mm-dd of current date. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowDate)] - [[play](https://go.dev/play/p/PvfkPpcpBBf)] -- **GetNowTime** : return format hh-mm-ss of current time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowTime)] - [[play](https://go.dev/play/p/l7BNxCkTmJS)] -- **GetNowDateTime** : return format yyyy-mm-dd hh-mm-ss of current datetime. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowDateTime)] - [[play](https://go.dev/play/p/pI4AqngD0al)] -- **GetTodayStartTime** : return the start time of today, format: yyyy-mm-dd 00:00:00. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetTodayStartTime)] - [[play](https://go.dev/play/p/84siyYF7t99)] -- **GetTodayEndTime** : return the end time of today, format: yyyy-mm-dd 23:59:59. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetTodayEndTime)] - [[play](https://go.dev/play/p/jjrLnfoqgn3)] -- **GetZeroHourTimestamp** : return timestamp of zero hour (timestamp of 00:00). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetZeroHourTimestamp)] - [[play](https://go.dev/play/p/QmL2oIaGE3q)] -- **GetNightTimestamp** : return timestamp of zero hour (timestamp of 23:59). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNightTimestamp)] - [[play](https://go.dev/play/p/UolysR3MYP1)] -- **FormatTimeToStr** : convert time to string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#FormatTimeToStr)] - [[play](https://go.dev/play/p/_Ia7M8H_OvE)] -- **FormatStrToTime** : convert string to time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#FormatStrToTime)] - [[play](https://go.dev/play/p/1h9FwdU8ql4)] -- **NewUnix** : return unix timestamp of specific time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewUnix)] - [[play](https://go.dev/play/p/psoSuh_kLRt)] -- **NewUnixNow** : return unix timestamp of current time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewUnixNow)] - [[play](https://go.dev/play/p/U4PPx-9D0oz)] -- **NewFormat** : return unix timestamp of specific time string, t should be "yyyy-mm-dd hh:mm:ss". - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewFormat)] - [[play](https://go.dev/play/p/VkW08ZOaXPZ)] -- **NewISO8601** : return unix timestamp of specific iso8601 time string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewISO8601)] - [[play](https://go.dev/play/p/mkhOHQkdeA2)] -- **ToUnix** : return unix timestamp. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToUnix)] - [[play](https://go.dev/play/p/_LUiwAdocjy)] -- **ToFormat** : return the time string 'yyyy-mm-dd hh:mm:ss' of unix time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToFormat)] - [[play](https://go.dev/play/p/VkW08ZOaXPZ)] -- **ToFormatForTpl** : return the time string which format is specific tpl. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToFormatForTpl)] - [[play](https://go.dev/play/p/nyXxXcQJ8L5)] -- **ToIso8601** : return iso8601 time string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToIso8601)] - [[play](https://go.dev/play/p/mkhOHQkdeA2)] -- **IsLeapYear** : check if param `year` is leap year or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#IsLeapYear)] - [[play](https://go.dev/play/p/xS1eS2ejGew)] -- **BetweenSeconds** : returns the number of seconds between two times. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BetweenSeconds)] - [[play](https://go.dev/play/p/n3YDRyfyXJu)] -- **DayOfYear** : returns which day of the year the parameter date `t` is. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#DayOfYear)] - [[play](https://go.dev/play/p/0hjqhTwFNlH)] -- **IsWeekend** : checks if passed time is weekend or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#IsWeekend)] - [[play](https://go.dev/play/p/cupRM5aZOIY)] -- **NowDateOrTime** : returns current datetime with specific format and timezone. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NowDateOrTime)] - [[play](https://go.dev/play/p/EZ-begEjtT0)] -- **Timestamp** : returns current second timestamp. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#Timestamp)] -- **TimestampMilli** : returns current mill second timestamp. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampMilli)] - [[play](https://go.dev/play/p/4gvEusOTu1T)] -- **TimestampMicro** : returns current micro second timestamp. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampMicro)] - [[play](https://go.dev/play/p/2maANglKHQE)] -- **TimestampNano** : returns current nano second timestamp. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampNano)] - [[play](https://go.dev/play/p/A9Oq_COrcCF)] -- **TrackFuncTime** : tracks function execution time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TrackFuncTime)] - [[play](https://go.dev/play/p/QBSEdfXHPTp)] -- **DaysBetween** : returns the number of days between two times. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#DaysBetween)] - [[play](https://go.dev/play/p/qD6qGb3TbOy)] -- **GenerateDatetimesBetween** : returns a slice of strings between two times. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GenerateDatetimesBetween)] - [[play](https://go.dev/play/p/6kHBpAxD9ZC)] -- **Min** : returns the earliest time among the given times. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#Min)] - [[play](https://go.dev/play/p/MCIDvHNOGGb)] -- **Max** : returns the latest time among the given times. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#Max)] - [[play](https://go.dev/play/p/9m6JMk1LB7-)] -- **MaxMin** : returns the latest and earliest time among the given times. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#MaxMin)] - [[play](https://go.dev/play/p/rbW51cDtM_2)] +- **AddDay** : add or sub day to the time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddDay)] + [[play](https://go.dev/play/p/dIGbs_uTdFa)] +- **AddHour** : add or sub day to the time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddHour)] + [[play](https://go.dev/play/p/rcMjd7OCsi5)] +- **AddMinute** : add or sub day to the time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddMinute)] + [[play](https://go.dev/play/p/nT1heB1KUUK)] +- **AddWeek** : add or sub week to time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddWeek)] + [[play](https://go.dev/play/p/M9TqdMiaA2p)] +- **AddMonth** : add or sub months to time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddMonth)] + [[play](https://go.dev/play/p/DLoiOnpLvsN)] +- **AddYear** : add or sub year to the time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddYear)] + [[play](https://go.dev/play/p/MqW2ujnBx10)] +- **AddDaySafe** : add or sub days to the time and ensure that the returned date does not exceed the valid date of the target year and month. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddDaySafe)] + [[play](https://go.dev/play/p/JTohZFpoDJ3)] +- **AddMonthSafe** : add or sub months to the time and ensure that the returned date does not exceed the valid date of the target year and month. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddMonthSafe)] + [[play](https://go.dev/play/p/KLw0lo6mbVW)] +- **AddYearSafe** : Add or sub years to the time and ensure that the returned date does not exceed the valid date of the target year and month. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddYearSafe)] + [[play](https://go.dev/play/p/KVGXWZZ54ZH)] +- **BeginOfMinute** : return the date time at the begin of minute of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfMinute)] + [[play](https://go.dev/play/p/ieOLVJ9CiFT)] +- **BeginOfHour** : return the date time at the begin of hour of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfHour)] + [[play](https://go.dev/play/p/GhdGFnDWpYs)] +- **BeginOfDay** : return the date time at the begin of day of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfDay)] + [[play](https://go.dev/play/p/94m_UT6cWs9)] +- **BeginOfWeek** : return the date time at the begin of week of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfWeek)] + [[play](https://go.dev/play/p/DCHdcL6gnfV)] +- **BeginOfMonth** : return the date time at the begin of month of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfMonth)] + [[play](https://go.dev/play/p/bWXVFsmmzwL)] +- **BeginOfYear** : return the date time at the begin of year of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfYear)] + [[play](https://go.dev/play/p/i326DSwLnV8)] +- **EndOfMinute** : return the date time at the end of minute of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfMinute)] + [[play](https://go.dev/play/p/yrL5wGzPj4z)] +- **EndOfHour** : return the date time at the end of hour of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfHour)] + [[play](https://go.dev/play/p/6ce3j_6cVqN)] +- **EndOfDay** : return the date time at the end of day of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfDay)] + [[play](https://go.dev/play/p/eMBOvmq5Ih1)] +- **EndOfWeek** : return the date time at the end of week of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfWeek)] + [[play](https://go.dev/play/p/mGSA162YgX9)] +- **EndOfMonth** : return the date time at the end of month of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfMonth)] + [[play](https://go.dev/play/p/_GWh10B3Nqi)] +- **EndOfYear** : return the date time at the end of year of specific date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfYear)] + [[play](https://go.dev/play/p/G01cKlMCvNm)] +- **GetNowDate** : return format yyyy-mm-dd of current date. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowDate)] + [[play](https://go.dev/play/p/PvfkPpcpBBf)] +- **GetNowTime** : return format hh-mm-ss of current time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowTime)] + [[play](https://go.dev/play/p/l7BNxCkTmJS)] +- **GetNowDateTime** : return format yyyy-mm-dd hh-mm-ss of current datetime. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowDateTime)] + [[play](https://go.dev/play/p/pI4AqngD0al)] +- **GetTodayStartTime** : return the start time of today, format: yyyy-mm-dd 00:00:00. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetTodayStartTime)] + [[play](https://go.dev/play/p/84siyYF7t99)] +- **GetTodayEndTime** : return the end time of today, format: yyyy-mm-dd 23:59:59. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetTodayEndTime)] + [[play](https://go.dev/play/p/jjrLnfoqgn3)] +- **GetZeroHourTimestamp** : return timestamp of zero hour (timestamp of 00:00). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetZeroHourTimestamp)] + [[play](https://go.dev/play/p/QmL2oIaGE3q)] +- **GetNightTimestamp** : return timestamp of zero hour (timestamp of 23:59). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNightTimestamp)] + [[play](https://go.dev/play/p/UolysR3MYP1)] +- **FormatTimeToStr** : convert time to string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#FormatTimeToStr)] + [[play](https://go.dev/play/p/_Ia7M8H_OvE)] +- **FormatStrToTime** : convert string to time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#FormatStrToTime)] + [[play](https://go.dev/play/p/1h9FwdU8ql4)] +- **NewUnix** : return unix timestamp of specific time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewUnix)] + [[play](https://go.dev/play/p/psoSuh_kLRt)] +- **NewUnixNow** : return unix timestamp of current time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewUnixNow)] + [[play](https://go.dev/play/p/U4PPx-9D0oz)] +- **NewFormat** : return unix timestamp of specific time string, t should be "yyyy-mm-dd hh:mm:ss". + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewFormat)] + [[play](https://go.dev/play/p/VkW08ZOaXPZ)] +- **NewISO8601** : return unix timestamp of specific iso8601 time string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewISO8601)] + [[play](https://go.dev/play/p/mkhOHQkdeA2)] +- **ToUnix** : return unix timestamp. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToUnix)] + [[play](https://go.dev/play/p/_LUiwAdocjy)] +- **ToFormat** : return the time string 'yyyy-mm-dd hh:mm:ss' of unix time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToFormat)] + [[play](https://go.dev/play/p/VkW08ZOaXPZ)] +- **ToFormatForTpl** : return the time string which format is specific tpl. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToFormatForTpl)] + [[play](https://go.dev/play/p/nyXxXcQJ8L5)] +- **ToIso8601** : return iso8601 time string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToIso8601)] + [[play](https://go.dev/play/p/mkhOHQkdeA2)] +- **IsLeapYear** : check if param `year` is leap year or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#IsLeapYear)] + [[play](https://go.dev/play/p/xS1eS2ejGew)] +- **BetweenSeconds** : returns the number of seconds between two times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BetweenSeconds)] + [[play](https://go.dev/play/p/n3YDRyfyXJu)] +- **DayOfYear** : returns which day of the year the parameter date `t` is. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#DayOfYear)] + [[play](https://go.dev/play/p/0hjqhTwFNlH)] +- **IsWeekend** : checks if passed time is weekend or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#IsWeekend)] + [[play](https://go.dev/play/p/cupRM5aZOIY)] +- **NowDateOrTime** : returns current datetime with specific format and timezone. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NowDateOrTime)] + [[play](https://go.dev/play/p/EZ-begEjtT0)] +- **Timestamp** : returns current second timestamp. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#Timestamp)] +- **TimestampMilli** : returns current mill second timestamp. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampMilli)] + [[play](https://go.dev/play/p/4gvEusOTu1T)] +- **TimestampMicro** : returns current micro second timestamp. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampMicro)] + [[play](https://go.dev/play/p/2maANglKHQE)] +- **TimestampNano** : returns current nano second timestamp. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampNano)] + [[play](https://go.dev/play/p/A9Oq_COrcCF)] +- **TrackFuncTime** : tracks function execution time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TrackFuncTime)] + [[play](https://go.dev/play/p/QBSEdfXHPTp)] +- **DaysBetween** : returns the number of days between two times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#DaysBetween)] + [[play](https://go.dev/play/p/qD6qGb3TbOy)] +- **GenerateDatetimesBetween** : returns a slice of strings between two times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GenerateDatetimesBetween)] + [[play](https://go.dev/play/p/6kHBpAxD9ZC)] +- **Min** : returns the earliest time among the given times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#Min)] + [[play](https://go.dev/play/p/MCIDvHNOGGb)] +- **Max** : returns the latest time among the given times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#Max)] + [[play](https://go.dev/play/p/9m6JMk1LB7-)] +- **MaxMin** : returns the latest and earliest time among the given times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#MaxMin)] + [[play](https://go.dev/play/p/rbW51cDtM_2)]

8. Datastructure package contains some common data structure. eg. list, linklist, stack, queue, set, tree, graph.        index

@@ -732,26 +732,26 @@ import optional "github.com/duke-git/lancet/v2/datastructure/optional" #### Structure list: -- **List** : a linear table, implemented with slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/list.md)] -- **CopyOnWriteList** : a thread-safe list implementation that uses go slicing as its base. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/copyonwritelist.md)] -- **Link** : link list structure, contains singly link and doubly link. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/link.md)] -- **Stack** : stack structure(fifo), contains array stack and link stack. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/stack.md)] -- **Queue** : queue structure(filo), contains array queue, circular queue, link queue and priority queue. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/queue.md)] -- **Set** : a data container, like slice, but element of set is not duplicate. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/set.md)] -- **Tree** : binary search tree structure. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/tree.md)] -- **Heap** : a binary max heap. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/heap.md)] -- **Hashmap** : hash map structure. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/hashmap.md)] -- **Optional** : Optional container. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/optional.md)] +- **List** : a linear table, implemented with slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/list.md)] +- **CopyOnWriteList** : a thread-safe list implementation that uses go slicing as its base. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/copyonwritelist.md)] +- **Link** : link list structure, contains singly link and doubly link. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/link.md)] +- **Stack** : stack structure(fifo), contains array stack and link stack. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/stack.md)] +- **Queue** : queue structure(filo), contains array queue, circular queue, link queue and priority queue. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/queue.md)] +- **Set** : a data container, like slice, but element of set is not duplicate. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/set.md)] +- **Tree** : binary search tree structure. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/tree.md)] +- **Heap** : a binary max heap. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/heap.md)] +- **Hashmap** : hash map structure. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/hashmap.md)] +- **Optional** : Optional container. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/optional.md)]

9. EventBus is an event bus used for handling events within an application.        Index

@@ -761,36 +761,36 @@ import "github.com/duke-git/lancet/v2/eventbus" #### Function list: -- **NewEventBus** : Create an EventBus instance. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#NewEventBus)] - [[play](https://go.dev/play/p/gHbOPV_NUOJ)] -- **Subscribe** : subscribes to an event with a specific event topic and listener function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#Subscribe)] - [[play](https://go.dev/play/p/EYGf_8cHei-)] -- **Unsubscribe** : unsubscribes from an event with a specific event topic and listener function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#Unsubscribe)] - [[play](https://go.dev/play/p/Tmh7Ttfvprf)] -- **Publish** : publishes an event with a specific event topic and data payload. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#Publish)] - [[play](https://go.dev/play/p/gHTtVexFSH9)] -- **ClearListeners** : clears all the listeners. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#ClearListeners)] - [[play](https://go.dev/play/p/KBfBYlKPgqD)] -- **ClearListenersByTopic** : clears all the listeners by topic. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#ClearListenersByTopic)] - [[play](https://go.dev/play/p/gvMljmJOZmU)] -- **GetListenersCount** : returns the number of listeners for a specific event topic. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#GetListenersCount)] - [[play](https://go.dev/play/p/8VPJsMQgStM)] -- **GetAllListenersCount** : returns the total number of all listeners. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#GetAllListenersCount)] - [[play](https://go.dev/play/p/PUlr0xcpEOz)] -- **GetEvents** : returns all the events topics. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#GetEvents)] - [[play](https://go.dev/play/p/etgjjcOtAjX)] -- **SetErrorHandler** : sets the error handler function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#SetErrorHandler)] - [[play](https://go.dev/play/p/gmB0gnFe5mc)] +- **NewEventBus** : Create an EventBus instance. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#NewEventBus)] + [[play](https://go.dev/play/p/gHbOPV_NUOJ)] +- **Subscribe** : subscribes to an event with a specific event topic and listener function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#Subscribe)] + [[play](https://go.dev/play/p/EYGf_8cHei-)] +- **Unsubscribe** : unsubscribes from an event with a specific event topic and listener function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#Unsubscribe)] + [[play](https://go.dev/play/p/Tmh7Ttfvprf)] +- **Publish** : publishes an event with a specific event topic and data payload. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#Publish)] + [[play](https://go.dev/play/p/gHTtVexFSH9)] +- **ClearListeners** : clears all the listeners. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#ClearListeners)] + [[play](https://go.dev/play/p/KBfBYlKPgqD)] +- **ClearListenersByTopic** : clears all the listeners by topic. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#ClearListenersByTopic)] + [[play](https://go.dev/play/p/gvMljmJOZmU)] +- **GetListenersCount** : returns the number of listeners for a specific event topic. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#GetListenersCount)] + [[play](https://go.dev/play/p/8VPJsMQgStM)] +- **GetAllListenersCount** : returns the total number of all listeners. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#GetAllListenersCount)] + [[play](https://go.dev/play/p/PUlr0xcpEOz)] +- **GetEvents** : returns all the events topics. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#GetEvents)] + [[play](https://go.dev/play/p/etgjjcOtAjX)] +- **SetErrorHandler** : sets the error handler function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/eventbus.md#SetErrorHandler)] + [[play](https://go.dev/play/p/gmB0gnFe5mc)]

10. Package enum provides a simple enum implementation.        Index

@@ -800,60 +800,60 @@ import "github.com/duke-git/lancet/v2/enum" #### Function list: -- **NewItem** : Creates a new enum item. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#NewEventBus)] - [[play](https://go.dev/play/p/8qNsLw01HD5)] -- **NewItemsFromPairs** : Creates enum items from a slice of Pair structs. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#NewItemsFromPairs)] - [[play](https://go.dev/play/p/xKnoGa7gnev)] -- **Value** : Returns the value of the enum item. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Value)] - [[play](https://go.dev/play/p/xKnoGa7gnev)] -- **Name** : Returns the name of the enum item. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Name)] - [[play](https://go.dev/play/p/xKnoGa7gnev)] -- **Valid** : Checks if the enum item is valid. If a custom check function is provided, it will be used to validate the value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Valid)] - [[play](https://go.dev/play/p/pA3lYY2VSm3)] -- **MarshalJSON** : Implementation of json.Marshaler interface. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#MarshalJSON)] - [[play](https://go.dev/play/p/zIZEdAnneB5)] -- **NewRegistry** : Creates a new enum registry. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#NewRegistry)] - [[play](https://go.dev/play/p/ABEXsYfJKMo)] -- **Add** : Adds enum items to the registry. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Add)] - [[play](https://go.dev/play/p/ABEXsYfJKMo)] -- **Remove** : Removes an enum item from the registry by its value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Remove)] - [[play](https://go.dev/play/p/dSG84wQ3TuC)] -- **Update** : Updates the name of an enum item in the registry by its value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Update)] - [[play](https://go.dev/play/p/Ol0moT1J9Xl)] -- **GetByValue** : Retrieves an enum item by its value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#GetByValue)] - [[play](https://go.dev/play/p/niJ1U2KlE_m)] -- **GetByName** : Retrieves an enum item by its name. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#GetByName)] - [[play](https://go.dev/play/p/49ie_gpqH0m)] -- **Items** : Returns a slice of all enum items in the registry. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Items)] - [[play](https://go.dev/play/p/lAJFAradbvQ)] -- **Contains** : Checks if an enum item with the given value exists in the registry. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Contains)] - [[play](https://go.dev/play/p/_T-lPYkZn2j)] -- **Size** : Returns the number of enum items in the registry. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Size)] - [[play](https://go.dev/play/p/TeDArWhlQe2)] -- **Range** : Iterates over all enum items in the registry and applies the given function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Range)] - [[play](https://go.dev/play/p/GPsZbQbefWN)] -- **SortedItems** : Returns a slice of all enum items sorted by the given less function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#SortedItems)] - [[play](https://go.dev/play/p/tN9RE_m_WEI)] -- **Filter** : Returns a slice of enum items that satisfy the given predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Filter)] - [[play](https://go.dev/play/p/uTUpTdcyoCU)] +- **NewItem** : Creates a new enum item. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#NewEventBus)] + [[play](https://go.dev/play/p/8qNsLw01HD5)] +- **NewItemsFromPairs** : Creates enum items from a slice of Pair structs. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#NewItemsFromPairs)] + [[play](https://go.dev/play/p/xKnoGa7gnev)] +- **Value** : Returns the value of the enum item. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Value)] + [[play](https://go.dev/play/p/xKnoGa7gnev)] +- **Name** : Returns the name of the enum item. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Name)] + [[play](https://go.dev/play/p/xKnoGa7gnev)] +- **Valid** : Checks if the enum item is valid. If a custom check function is provided, it will be used to validate the value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Valid)] + [[play](https://go.dev/play/p/pA3lYY2VSm3)] +- **MarshalJSON** : Implementation of json.Marshaler interface. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#MarshalJSON)] + [[play](https://go.dev/play/p/zIZEdAnneB5)] +- **NewRegistry** : Creates a new enum registry. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#NewRegistry)] + [[play](https://go.dev/play/p/ABEXsYfJKMo)] +- **Add** : Adds enum items to the registry. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Add)] + [[play](https://go.dev/play/p/ABEXsYfJKMo)] +- **Remove** : Removes an enum item from the registry by its value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Remove)] + [[play](https://go.dev/play/p/dSG84wQ3TuC)] +- **Update** : Updates the name of an enum item in the registry by its value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Update)] + [[play](https://go.dev/play/p/Ol0moT1J9Xl)] +- **GetByValue** : Retrieves an enum item by its value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#GetByValue)] + [[play](https://go.dev/play/p/niJ1U2KlE_m)] +- **GetByName** : Retrieves an enum item by its name. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#GetByName)] + [[play](https://go.dev/play/p/49ie_gpqH0m)] +- **Items** : Returns a slice of all enum items in the registry. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Items)] + [[play](https://go.dev/play/p/lAJFAradbvQ)] +- **Contains** : Checks if an enum item with the given value exists in the registry. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Contains)] + [[play](https://go.dev/play/p/_T-lPYkZn2j)] +- **Size** : Returns the number of enum items in the registry. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Size)] + [[play](https://go.dev/play/p/TeDArWhlQe2)] +- **Range** : Iterates over all enum items in the registry and applies the given function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Range)] + [[play](https://go.dev/play/p/GPsZbQbefWN)] +- **SortedItems** : Returns a slice of all enum items sorted by the given less function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#SortedItems)] + [[play](https://go.dev/play/p/tN9RE_m_WEI)] +- **Filter** : Returns a slice of enum items that satisfy the given predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/enum.md#Filter)] + [[play](https://go.dev/play/p/uTUpTdcyoCU)]

11. Fileutil package implements some basic functions for file operations.        index

@@ -863,99 +863,99 @@ import "github.com/duke-git/lancet/v2/fileutil" #### Function list: -- **ClearFile** : write empty string to target file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ClearFile)] - [[play](https://go.dev/play/p/NRZ0ZT-G94H)] -- **CreateFile** : create file in path. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CreateFile)] - [[play](https://go.dev/play/p/lDt8PEsTNKI)] -- **CreateDir** : create directory in absolute path. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CreateDir)] - [[play](https://go.dev/play/p/qUuCe1OGQnM)] -- **CopyFile** : copy src file to dest file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CopyFile)] - [[play](https://go.dev/play/p/Jg9AMJMLrJi)] -- **CopyDir** : copy src directory to dest directory. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CopyDir)] - [[play](https://go.dev/play/p/YAyFTA_UuPb)] -- **FileMode** : return file's mode and permission. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#FileMode)] - [[play](https://go.dev/play/p/2l2hI42fA3p)] -- **MiMeType** : return file mime type. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#MiMeType)] - [[play](https://go.dev/play/p/bd5sevSUZNu)] -- **IsExist** : checks if a file or directory exists. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsExist)] - [[play](https://go.dev/play/p/nKKXt8ZQbmh)] -- **IsLink** : checks if a file is symbol link or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsLink)] - [[play](https://go.dev/play/p/TL-b-Kzvf44)] -- **IsDir** : checks if the path is directory or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsDir)] - [[play](https://go.dev/play/p/WkVwEKqtOWk)] -- **ListFileNames** : return all file names in the path. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ListFileNames)] - [[play](https://go.dev/play/p/Tjd7Y07rejl)] -- **RemoveFile** : remove file, param should be file path. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#RemoveFile)] - [[play](https://go.dev/play/p/P2y0XW8a1SH)] -- **RemoveDir** : delete directory. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#RemoveDir)] - [[play](https://go.dev/play/p/Oa6KnPek2uy)] -- **ReadFileToString** : return string of file content. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFileToString)] - [[play](https://go.dev/play/p/cmfwp_5SQTp)] -- **ReadFileByLine** : read file line by line, return string slice of file content. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFileByLine)] - [[play](https://go.dev/play/p/svJP_7ZrBrD)] -- **Zip** : create a zip file of fpath, fpath could be a file or a directory. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#Zip)] - [[play](https://go.dev/play/p/j-3sWBp8ik_P)] -- **ZipAppendEntry** : append a single file or directory by fpath to an existing zip file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ZipAppendEntry)] -- **UnZip** : unzip the zip file and save it to dest path. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#UnZip)] - [[play](https://go.dev/play/p/g0w34kS7B8m)] -- **CurrentPath** : return current absolute path. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CurrentPath)] - [[play](https://go.dev/play/p/s74a9iBGcSw)] -- **IsZipFile** : checks if file is zip file or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsZipFile)] - [[play](https://go.dev/play/p/9M0g2j_uF_e)] -- **FileSize** : return file size in bytes. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#FileSize)] - [[play](https://go.dev/play/p/H9Z05uD-Jjc)] -- **MTime** : return file modified time(unix timestamp). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#MTime)] - [[play](https://go.dev/play/p/s_Tl7lZoAaY)] -- **Sha** : return file sha value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#Sha)] - [[play](https://go.dev/play/p/VfEEcO2MJYf)] -- **ReadCsvFile** : read file content into slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadCsvFile)] - [[play](https://go.dev/play/p/OExTkhGEd3_u)] -- **WriteCsvFile** : write content to target csv file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteCsvFile)] -- **WriteMapsToCsv** : write slice of map to csv file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteMapsToCsv)] - [[play](https://go.dev/play/p/umAIomZFV1c)] -- **WriteBytesToFile** : write bytes to target file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteBytesToFile)] - [[play](https://go.dev/play/p/s7QlDxMj3P8)] -- **WriteStringToFile** : write string to target file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteStringToFile)] - [[play](https://go.dev/play/p/GhLS6d8lH_g)] -- **ReadFile** : read file or url. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFile)] -- **ChunkRead** : reads a block from the file at the specified offset and returns all lines within the block. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ChunkRead)] - [[play](https://go.dev/play/p/r0hPmKWhsgf)] -- **ParallelChunkRead** : reads the file in parallel and send each chunk of lines to the specified channel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ParallelChunkRead)] - [[play](https://go.dev/play/p/teMXnCsdSEw)] -- **GetExeOrDllVersion** : Get the version of exe or dll file on windows os. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#GetExeOrDllVersion)] - [[play](https://go.dev/play/p/iLRrDBhE38E)] +- **ClearFile** : write empty string to target file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ClearFile)] + [[play](https://go.dev/play/p/NRZ0ZT-G94H)] +- **CreateFile** : create file in path. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CreateFile)] + [[play](https://go.dev/play/p/lDt8PEsTNKI)] +- **CreateDir** : create directory in absolute path. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CreateDir)] + [[play](https://go.dev/play/p/qUuCe1OGQnM)] +- **CopyFile** : copy src file to dest file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CopyFile)] + [[play](https://go.dev/play/p/Jg9AMJMLrJi)] +- **CopyDir** : copy src directory to dest directory. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CopyDir)] + [[play](https://go.dev/play/p/YAyFTA_UuPb)] +- **FileMode** : return file's mode and permission. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#FileMode)] + [[play](https://go.dev/play/p/2l2hI42fA3p)] +- **MiMeType** : return file mime type. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#MiMeType)] + [[play](https://go.dev/play/p/bd5sevSUZNu)] +- **IsExist** : checks if a file or directory exists. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsExist)] + [[play](https://go.dev/play/p/nKKXt8ZQbmh)] +- **IsLink** : checks if a file is symbol link or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsLink)] + [[play](https://go.dev/play/p/TL-b-Kzvf44)] +- **IsDir** : checks if the path is directory or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsDir)] + [[play](https://go.dev/play/p/WkVwEKqtOWk)] +- **ListFileNames** : return all file names in the path. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ListFileNames)] + [[play](https://go.dev/play/p/Tjd7Y07rejl)] +- **RemoveFile** : remove file, param should be file path. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#RemoveFile)] + [[play](https://go.dev/play/p/P2y0XW8a1SH)] +- **RemoveDir** : delete directory. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#RemoveDir)] + [[play](https://go.dev/play/p/Oa6KnPek2uy)] +- **ReadFileToString** : return string of file content. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFileToString)] + [[play](https://go.dev/play/p/cmfwp_5SQTp)] +- **ReadFileByLine** : read file line by line, return string slice of file content. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFileByLine)] + [[play](https://go.dev/play/p/svJP_7ZrBrD)] +- **Zip** : create a zip file of fpath, fpath could be a file or a directory. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#Zip)] + [[play](https://go.dev/play/p/j-3sWBp8ik_P)] +- **ZipAppendEntry** : append a single file or directory by fpath to an existing zip file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ZipAppendEntry)] +- **UnZip** : unzip the zip file and save it to dest path. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#UnZip)] + [[play](https://go.dev/play/p/g0w34kS7B8m)] +- **CurrentPath** : return current absolute path. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CurrentPath)] + [[play](https://go.dev/play/p/s74a9iBGcSw)] +- **IsZipFile** : checks if file is zip file or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsZipFile)] + [[play](https://go.dev/play/p/9M0g2j_uF_e)] +- **FileSize** : return file size in bytes. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#FileSize)] + [[play](https://go.dev/play/p/H9Z05uD-Jjc)] +- **MTime** : return file modified time(unix timestamp). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#MTime)] + [[play](https://go.dev/play/p/s_Tl7lZoAaY)] +- **Sha** : return file sha value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#Sha)] + [[play](https://go.dev/play/p/VfEEcO2MJYf)] +- **ReadCsvFile** : read file content into slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadCsvFile)] + [[play](https://go.dev/play/p/OExTkhGEd3_u)] +- **WriteCsvFile** : write content to target csv file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteCsvFile)] +- **WriteMapsToCsv** : write slice of map to csv file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteMapsToCsv)] + [[play](https://go.dev/play/p/umAIomZFV1c)] +- **WriteBytesToFile** : write bytes to target file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteBytesToFile)] + [[play](https://go.dev/play/p/s7QlDxMj3P8)] +- **WriteStringToFile** : write string to target file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteStringToFile)] + [[play](https://go.dev/play/p/GhLS6d8lH_g)] +- **ReadFile** : read file or url. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFile)] +- **ChunkRead** : reads a block from the file at the specified offset and returns all lines within the block. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ChunkRead)] + [[play](https://go.dev/play/p/r0hPmKWhsgf)] +- **ParallelChunkRead** : reads the file in parallel and send each chunk of lines to the specified channel. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ParallelChunkRead)] + [[play](https://go.dev/play/p/teMXnCsdSEw)] +- **GetExeOrDllVersion** : Get the version of exe or dll file on windows os. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#GetExeOrDllVersion)] + [[play](https://go.dev/play/p/iLRrDBhE38E)]

12. Formatter contains some functions for data formatting.        index

@@ -965,33 +965,33 @@ import "github.com/duke-git/lancet/v2/formatter" #### Function list: -- **Comma** : add comma to a number value by every 3 numbers from right, ahead by a prefix symbol char. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#Comma)] - [[play](https://go.dev/play/p/eRD5k2vzUVX)] -- **Pretty** : pretty print data to JSON string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#Pretty)] - [[play](https://go.dev/play/p/YsciGj3FH2x)] -- **PrettyToWriter** : pretty encode data to writer. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#PrettyToWriter)] - [[play](https://go.dev/play/p/LPLZ3lDi5ma)] -- **DecimalBytes** : returns a human readable byte size under decimal standard (base 1000). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#DecimalBytes)] - [[play](https://go.dev/play/p/FPXs1suwRcs)] -- **BinaryBytes** : returns a human-readable byte size under binary standard (base 1024). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#BinaryBytes)] - [[play](https://go.dev/play/p/G9oHHMCAZxP)] -- **ParseDecimalBytes** : return the human readable bytes size string into the amount it represents(base 1000). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseDecimalBytes)] - [[play](https://go.dev/play/p/Am98ybWjvjj)] -- **ParseBinaryBytes** : return the human readable bytes size string into the amount it represents(base 1024). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseBinaryBytes)] - [[play](https://go.dev/play/p/69v1tTT62x8)] -- **ParseCNAddress** : parses a Chinese address string intelligently and extracts structured information (province, city, district, street, name, phone, etc.). Supports various address formats including county-level cities. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseCNAddress)] - [[play](https://go.dev/play/p/o5l09hQopEV)] -- **ParsePersonInfo** : extracts user information (name, phone, ID card, postal code) from an address string and separates it from the location address. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParsePersonInfo)] - [[play](https://go.dev/play/p/JO-uTlJlTy7)] +- **Comma** : add comma to a number value by every 3 numbers from right, ahead by a prefix symbol char. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#Comma)] + [[play](https://go.dev/play/p/eRD5k2vzUVX)] +- **Pretty** : pretty print data to JSON string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#Pretty)] + [[play](https://go.dev/play/p/YsciGj3FH2x)] +- **PrettyToWriter** : pretty encode data to writer. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#PrettyToWriter)] + [[play](https://go.dev/play/p/LPLZ3lDi5ma)] +- **DecimalBytes** : returns a human readable byte size under decimal standard (base 1000). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#DecimalBytes)] + [[play](https://go.dev/play/p/FPXs1suwRcs)] +- **BinaryBytes** : returns a human-readable byte size under binary standard (base 1024). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#BinaryBytes)] + [[play](https://go.dev/play/p/G9oHHMCAZxP)] +- **ParseDecimalBytes** : return the human readable bytes size string into the amount it represents(base 1000). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseDecimalBytes)] + [[play](https://go.dev/play/p/Am98ybWjvjj)] +- **ParseBinaryBytes** : return the human readable bytes size string into the amount it represents(base 1024). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseBinaryBytes)] + [[play](https://go.dev/play/p/69v1tTT62x8)] +- **ParseCNAddress** : parses a Chinese address string intelligently and extracts structured information (province, city, district, street, name, phone, etc.). Supports various address formats including county-level cities. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseCNAddress)] + [[play](https://go.dev/play/p/o5l09hQopEV)] +- **ParsePersonInfo** : extracts user information (name, phone, ID card, postal code) from an address string and separates it from the location address. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParsePersonInfo)] + [[play](https://go.dev/play/p/JO-uTlJlTy7)]

13. Function package can control the flow of function execution and support part of functional programming.       index

@@ -1001,60 +1001,60 @@ import "github.com/duke-git/lancet/v2/function" #### Function list: -- **After** : return a function that invokes passed function once the returned function is called more than n times. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#After)] - [[play](https://go.dev/play/p/eRD5k2vzUVX)] -- **Before** : return a function that invokes passed function once the returned function is called less than n times - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Before)] - [[play](https://go.dev/play/p/0HqUDIFZ3IL)] -- **CurryFn** : make a curry function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#CurryFn)] - [[play](https://go.dev/play/p/5HopfDwANKX)] -- **Compose** : compose the functions from right to left. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Compose)] - [[play](https://go.dev/play/p/KKfugD4PKYF)] -- **Delay** : call the function after delayed time. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Delay)] - [[play](https://go.dev/play/p/Ivtc2ZE-Tye)] -- **Debounceddeprecated** : creates a debounced function that delays invoking fn until after wait duration have elapsed since the last time the debounced function was invoked. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Debounced)] - [[play](https://go.dev/play/p/absuEGB_GN7)] -- **Debounce** : creates a debounced version of the provided function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Debounce)] - [[play](https://go.dev/play/p/-dGFrYn_1Zi)] -- **Throttle** : creates a throttled version of the provided function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Throttle)] - [[play](https://go.dev/play/p/HpoMov-tJSN)] -- **Schedule** : invoke function every duration time, util close the returned bool channel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Schedule)] - [[play](https://go.dev/play/p/hbON-Xeyn5N)] -- **Pipeline** : takes a list of functions and returns a function whose param will be passed into the functions one by one. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Pipeline)] - [[play](https://go.dev/play/p/mPdUVvj6HD6)] -- **AcceptIf** : returns another function of the same signature as the apply function but also includes a bool value to indicate success or failure. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#AcceptIf)] - [[play](https://go.dev/play/p/XlXHHtzCf7d)] -- **And** : returns a composed predicate that represents the logical AND of a list of predicates. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#And)] - [[play](https://go.dev/play/p/dTBHJMQ0zD2)] -- **Or** : returns a composed predicate that represents the logical OR of a list of predicates. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Or)] - [[play](https://go.dev/play/p/LitCIsDFNDA)] -- **Negate** : returns a predicate that represents the logical negation of this predicate. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Negate)] - [[play](https://go.dev/play/p/jbI8BtgFnVE)] -- **Nor** : returns a composed predicate that represents the logical NOR of a list of predicates. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Nor)] - [[play](https://go.dev/play/p/2KdCoBEOq84)] -- **Nand** : returns a composed predicate that represents the logical Nand of a list of predicates. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Nand)] - [[play](https://go.dev/play/p/Rb-FdNGpgSO)] -- **Xnor** : returns a composed predicate that represents the logical XNOR of a list of predicates. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Xnor)] - [[play](https://go.dev/play/p/FJxko8SFbqc)] -- **Watcher** : Watcher is used for record code execution time. can start/stop/reset the watch timer. get the elapsed time of function execution. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Watcher)] - [[play](https://go.dev/play/p/l2yrOpCLd1I)] +- **After** : return a function that invokes passed function once the returned function is called more than n times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#After)] + [[play](https://go.dev/play/p/eRD5k2vzUVX)] +- **Before** : return a function that invokes passed function once the returned function is called less than n times + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Before)] + [[play](https://go.dev/play/p/0HqUDIFZ3IL)] +- **CurryFn** : make a curry function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#CurryFn)] + [[play](https://go.dev/play/p/5HopfDwANKX)] +- **Compose** : compose the functions from right to left. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Compose)] + [[play](https://go.dev/play/p/KKfugD4PKYF)] +- **Delay** : call the function after delayed time. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Delay)] + [[play](https://go.dev/play/p/Ivtc2ZE-Tye)] +- **Debounceddeprecated** : creates a debounced function that delays invoking fn until after wait duration have elapsed since the last time the debounced function was invoked. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Debounced)] + [[play](https://go.dev/play/p/absuEGB_GN7)] +- **Debounce** : creates a debounced version of the provided function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Debounce)] + [[play](https://go.dev/play/p/-dGFrYn_1Zi)] +- **Throttle** : creates a throttled version of the provided function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Throttle)] + [[play](https://go.dev/play/p/HpoMov-tJSN)] +- **Schedule** : invoke function every duration time, util close the returned bool channel. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Schedule)] + [[play](https://go.dev/play/p/hbON-Xeyn5N)] +- **Pipeline** : takes a list of functions and returns a function whose param will be passed into the functions one by one. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Pipeline)] + [[play](https://go.dev/play/p/mPdUVvj6HD6)] +- **AcceptIf** : returns another function of the same signature as the apply function but also includes a bool value to indicate success or failure. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#AcceptIf)] + [[play](https://go.dev/play/p/XlXHHtzCf7d)] +- **And** : returns a composed predicate that represents the logical AND of a list of predicates. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#And)] + [[play](https://go.dev/play/p/dTBHJMQ0zD2)] +- **Or** : returns a composed predicate that represents the logical OR of a list of predicates. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Or)] + [[play](https://go.dev/play/p/LitCIsDFNDA)] +- **Negate** : returns a predicate that represents the logical negation of this predicate. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Negate)] + [[play](https://go.dev/play/p/jbI8BtgFnVE)] +- **Nor** : returns a composed predicate that represents the logical NOR of a list of predicates. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Nor)] + [[play](https://go.dev/play/p/2KdCoBEOq84)] +- **Nand** : returns a composed predicate that represents the logical Nand of a list of predicates. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Nand)] + [[play](https://go.dev/play/p/Rb-FdNGpgSO)] +- **Xnor** : returns a composed predicate that represents the logical XNOR of a list of predicates. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Xnor)] + [[play](https://go.dev/play/p/FJxko8SFbqc)] +- **Watcher** : Watcher is used for record code execution time. can start/stop/reset the watch timer. get the elapsed time of function execution. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Watcher)] + [[play](https://go.dev/play/p/l2yrOpCLd1I)]

14. Maputil package includes some functions to manipulate map.       index

@@ -1064,174 +1064,174 @@ import "github.com/duke-git/lancet/v2/maputil" #### Function list: -- **MapTo** : quick map any value to struct or any base type. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapTo)] - [[play](https://go.dev/play/p/4K7KBEPgS5M)] -- **ForEach** : executes iteratee function for every key and value pair in map. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ForEach)] - [[play](https://go.dev/play/p/OaThj6iNVXK)] -- **Filter** : iterates over map, return a new map contains all key and value pairs pass the predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Filter)] - [[play](https://go.dev/play/p/fSvF3wxuNG7)] -- **FilterByKeys** : iterates over map, return a new map whose keys are all given keys - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FilterByKeys)] - [[play](https://go.dev/play/p/7ov6BJHbVqh)] -- **FilterByValues** : iterates over map, return a new map whose values are all given values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FilterByValues)] - [[play](https://go.dev/play/p/P3-9MdcXegR)] -- **OmitBy** : the opposite of Filter, removes all the map elements for which the predicate function returns true. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitBy)] - [[play](https://go.dev/play/p/YJM4Hj5hNwm)] -- **OmitByKeys** : the opposite of FilterByKeys, extracts all the map elements which keys are not omitted. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitByKeys)] - [[play](https://go.dev/play/p/jXGrWDBfSRp)] -- **OmitByValues** : the opposite of FilterByValues. remove all elements whose value are in the give slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitByValues)] - [[play](https://go.dev/play/p/XB7Y10uw20_U)] -- **Intersect** : iterates over maps, return a new map of key and value pairs in all given maps. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Intersect)] - [[play](https://go.dev/play/p/Zld0oj3sjcC)] -- **Keys** : returns a slice of the map's keys. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Keys)] - [[play](https://go.dev/play/p/xNB5bTb97Wd)] -- **KeysBy** : creates a slice whose element is the result of function mapper invoked by every map's key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#KeysBy)] - [[play](https://go.dev/play/p/hI371iB8Up8)] -- **Merge** : merge maps, next key will overwrite previous key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Merge)] - [[play](https://go.dev/play/p/H95LENF1uB-)] -- **Minus** : creates a map of whose key in mapA but not in mapB. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Minus)] - [[play](https://go.dev/play/p/3u5U9K7YZ9m)] -- **Values** : returns a slice of the map's values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Values)] - [[play](https://go.dev/play/p/CBKdUc5FTW6)] -- **ValuesBy** : creates a slice whose element is the result of function mapper invoked by every map's value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ValuesBy)] - [[play](https://go.dev/play/p/sg9-oRidh8f)] -- **MapKeys** : transforms a map to other type map by manipulating it's keys. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapKeys)] - [[play](https://go.dev/play/p/8scDxWeBDKd)] -- **MapValues** : transforms a map to other type map by manipulating it's values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapValues)] - [[play](https://go.dev/play/p/g92aY3fc7Iw)] -- **Entries** : transforms a map into array of key/value pairs. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Entries)] - [[play](https://go.dev/play/p/Ltb11LNcElY)] -- **FromEntries** : creates a map based on a slice of key/value pairs. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FromEntries)] - [[play](https://go.dev/play/p/fTdu4sCNjQO)] -- **Transform** : transform a map to another type map. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Transform)] - [[play](https://go.dev/play/p/P6ovfToM3zj)] -- **IsDisjoint** : check two map are disjoint if they have no keys in common. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#IsDisjoint)] - [[play](https://go.dev/play/p/N9qgYg_Ho6f)] -- **HasKey** : checks if map has key or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#HasKey)] - [[play](https://go.dev/play/p/isZZHOsDhFc)] -- **GetOrSet** : returns value of the given key or set the given value value if not present. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#GetOrSet)] - [[play](https://go.dev/play/p/IVQwO1OkEJC)] -- **MapToStruct** : converts map to struct. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapToStruct)] - [[play](https://go.dev/play/p/7wYyVfX38Dp)] -- **ToSortedSlicesDefault** : converts a map to two slices sorted by key: one for the keys and another for the values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToSortedSlicesDefault)] - [[play](https://go.dev/play/p/43gEM2po-qy)] -- **ToSortedSlicesWithComparator** : converts a map to two slices sorted by key and using a custom comparison function: one for the keys and another for the values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToSortedSlicesWithComparator)] - [[play](https://go.dev/play/p/0nlPo6YLdt3)] -- **NewOrderedMap** : creates a new OrderedMap. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#NewOrderedMap)] - [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] -- **OrderedMap_Set** : sets the given key-value pair for ordered map. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Set)] - [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] -- **OrderedMap_Get** : returns the value for the given key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Get)] - [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] -- **OrderedMap_Delete** : deletes the key-value pair for the given key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Delete)] - [[play](ttps://go.dev/play/p/5bIi4yaZ3K-)] -- **OrderedMap_Clear** : clears the ordered map. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Clear)] - [[play](https://go.dev/play/p/8LwoJyEfuFr)] -- **OrderedMap_Front** : returns the first key-value pair. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Front)] - [[play](https://go.dev/play/p/ty57XSimpoe)] -- **OrderedMap_Back** : returns the last key-value pair. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Back)] - [[play](https://go.dev/play/p/rQMjp1yQmpa)] -- **OrderedMap_Range** : calls the given function for each key-value pair. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Range)] - [[play](https://go.dev/play/p/U-KpORhc7LZ)] -- **OrderedMap_Keys** : returns the keys in order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Keys)] - [[play](https://go.dev/play/p/Vv_y9ExKclA)] -- **OrderedMap_Values** : returns the values in order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Values)] - [[play](https://go.dev/play/p/TWj5n1-PUfx)] -- **OrderedMap_Elements** : returns the key-value pairs in order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Elements)] - [[play](https://go.dev/play/p/4BHG4kKz6bB)] -- **OrderedMap_Len** : returns the number of key-value pairs. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Len)] - [[play](https://go.dev/play/p/cLe6z2VX5N-)] -- **OrderedMap_Contains** : returns true if the given key exists. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Contains)] - [[play](https://go.dev/play/p/QuwqqnzwDNX)] -- **OrderedMap_Iter** : returns a channel that yields key-value pairs in order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Iter)] - [[play](https://go.dev/play/p/tlq2tdvicPt)] -- **OrderedMap_ReverseIter** : returns a channel that yields key-value pairs in reverse order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_ReverseIter)] - [[play](https://go.dev/play/p/8Q0ssg6hZzO)] -- **OrderedMap_SortByKey** : sorts the map by key given less function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_SortByKey)] - [[play](https://go.dev/play/p/N7hjD_alZPq)] -- **OrderedMap_MarshalJSON** : implements the json.Marshaler interface. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_MarshalJSON)] - [[play](https://go.dev/play/p/C-wAwydIAC7)] -- **OrderedMap_UnmarshalJSON** : implements the json.Unmarshaler interface. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_UnmarshalJSON)] - [[play](https://go.dev/play/p/t_pkwerIRVx)] -- **NewConcurrentMap** : creates a ConcurrentMap with specific shard count. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#NewConcurrentMap)] - [[play](https://go.dev/play/p/3PenTPETJT0)] -- **ConcurrentMap_Set** : set the value for a key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Set)] - [[play](https://go.dev/play/p/3PenTPETJT0)] -- **ConcurrentMap_Get** : get the value stored in the map for a key, or nil if no. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Get)] - [[play](https://go.dev/play/p/3PenTPETJT0)] -- **ConcurrentMap_GetOrSet** : returns the existing value for the key if present. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_GetOrSet)] - [[play](https://go.dev/play/p/aDcDApOK01a)] -- **ConcurrentMap_Delete** : delete the value for a key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Delete)] - [[play](https://go.dev/play/p/uTIJZYhpVMS)] -- **ConcurrentMap_GetAndDelete** :returns the existing value for the key if present and then delete the value for the key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_GetAndDelete)] - [[play](https://go.dev/play/p/ZyxeIXSZUiM)] -- **ConcurrentMap_Has** : checks if map has the value for a key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Has)] - [[play](https://go.dev/play/p/C8L4ul9TVwf)] -- **ConcurrentMap_Range** : calls iterator sequentially for each key and value present in each of the shards in the map. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Range)] - [[play](https://go.dev/play/p/iqcy7P8P0Pr)] -- **SortByKey** : sorts the map by its keys and returns a new map with sorted keys. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#SortByKey)] - [[play](https://go.dev/play/p/PVdmBSnm6P_W)] -- **GetOrDefault** : returns the value of the given key or a default value if the key is not present. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#GetOrDefault)] - [[play](https://go.dev/play/p/99QjSYSBdiM)] -- **FindValuesBy** : returns a slice of values from the map that satisfy the given predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FindValuesBy)] - [[play](https://go.dev/play/p/bvNwNBZDm6v)] -- **ToMarkdownTable** : Convert a map slice data to a Markdown table string. It supports custom header display names and column display order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToMarkdownTable)] - [[play](https://go.dev/play/p/w_pSLfeyEB5)] +- **MapTo** : quick map any value to struct or any base type. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapTo)] + [[play](https://go.dev/play/p/4K7KBEPgS5M)] +- **ForEach** : executes iteratee function for every key and value pair in map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ForEach)] + [[play](https://go.dev/play/p/OaThj6iNVXK)] +- **Filter** : iterates over map, return a new map contains all key and value pairs pass the predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Filter)] + [[play](https://go.dev/play/p/fSvF3wxuNG7)] +- **FilterByKeys** : iterates over map, return a new map whose keys are all given keys + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FilterByKeys)] + [[play](https://go.dev/play/p/7ov6BJHbVqh)] +- **FilterByValues** : iterates over map, return a new map whose values are all given values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FilterByValues)] + [[play](https://go.dev/play/p/P3-9MdcXegR)] +- **OmitBy** : the opposite of Filter, removes all the map elements for which the predicate function returns true. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitBy)] + [[play](https://go.dev/play/p/YJM4Hj5hNwm)] +- **OmitByKeys** : the opposite of FilterByKeys, extracts all the map elements which keys are not omitted. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitByKeys)] + [[play](https://go.dev/play/p/jXGrWDBfSRp)] +- **OmitByValues** : the opposite of FilterByValues. remove all elements whose value are in the give slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitByValues)] + [[play](https://go.dev/play/p/XB7Y10uw20_U)] +- **Intersect** : iterates over maps, return a new map of key and value pairs in all given maps. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Intersect)] + [[play](https://go.dev/play/p/Zld0oj3sjcC)] +- **Keys** : returns a slice of the map's keys. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Keys)] + [[play](https://go.dev/play/p/xNB5bTb97Wd)] +- **KeysBy** : creates a slice whose element is the result of function mapper invoked by every map's key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#KeysBy)] + [[play](https://go.dev/play/p/hI371iB8Up8)] +- **Merge** : merge maps, next key will overwrite previous key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Merge)] + [[play](https://go.dev/play/p/H95LENF1uB-)] +- **Minus** : creates a map of whose key in mapA but not in mapB. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Minus)] + [[play](https://go.dev/play/p/3u5U9K7YZ9m)] +- **Values** : returns a slice of the map's values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Values)] + [[play](https://go.dev/play/p/CBKdUc5FTW6)] +- **ValuesBy** : creates a slice whose element is the result of function mapper invoked by every map's value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ValuesBy)] + [[play](https://go.dev/play/p/sg9-oRidh8f)] +- **MapKeys** : transforms a map to other type map by manipulating it's keys. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapKeys)] + [[play](https://go.dev/play/p/8scDxWeBDKd)] +- **MapValues** : transforms a map to other type map by manipulating it's values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapValues)] + [[play](https://go.dev/play/p/g92aY3fc7Iw)] +- **Entries** : transforms a map into array of key/value pairs. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Entries)] + [[play](https://go.dev/play/p/Ltb11LNcElY)] +- **FromEntries** : creates a map based on a slice of key/value pairs. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FromEntries)] + [[play](https://go.dev/play/p/fTdu4sCNjQO)] +- **Transform** : transform a map to another type map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Transform)] + [[play](https://go.dev/play/p/P6ovfToM3zj)] +- **IsDisjoint** : check two map are disjoint if they have no keys in common. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#IsDisjoint)] + [[play](https://go.dev/play/p/N9qgYg_Ho6f)] +- **HasKey** : checks if map has key or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#HasKey)] + [[play](https://go.dev/play/p/isZZHOsDhFc)] +- **GetOrSet** : returns value of the given key or set the given value value if not present. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#GetOrSet)] + [[play](https://go.dev/play/p/IVQwO1OkEJC)] +- **MapToStruct** : converts map to struct. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapToStruct)] + [[play](https://go.dev/play/p/7wYyVfX38Dp)] +- **ToSortedSlicesDefault** : converts a map to two slices sorted by key: one for the keys and another for the values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToSortedSlicesDefault)] + [[play](https://go.dev/play/p/43gEM2po-qy)] +- **ToSortedSlicesWithComparator** : converts a map to two slices sorted by key and using a custom comparison function: one for the keys and another for the values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToSortedSlicesWithComparator)] + [[play](https://go.dev/play/p/0nlPo6YLdt3)] +- **NewOrderedMap** : creates a new OrderedMap. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#NewOrderedMap)] + [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] +- **OrderedMap_Set** : sets the given key-value pair for ordered map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Set)] + [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] +- **OrderedMap_Get** : returns the value for the given key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Get)] + [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] +- **OrderedMap_Delete** : deletes the key-value pair for the given key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Delete)] + [[play](ttps://go.dev/play/p/5bIi4yaZ3K-)] +- **OrderedMap_Clear** : clears the ordered map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Clear)] + [[play](https://go.dev/play/p/8LwoJyEfuFr)] +- **OrderedMap_Front** : returns the first key-value pair. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Front)] + [[play](https://go.dev/play/p/ty57XSimpoe)] +- **OrderedMap_Back** : returns the last key-value pair. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Back)] + [[play](https://go.dev/play/p/rQMjp1yQmpa)] +- **OrderedMap_Range** : calls the given function for each key-value pair. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Range)] + [[play](https://go.dev/play/p/U-KpORhc7LZ)] +- **OrderedMap_Keys** : returns the keys in order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Keys)] + [[play](https://go.dev/play/p/Vv_y9ExKclA)] +- **OrderedMap_Values** : returns the values in order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Values)] + [[play](https://go.dev/play/p/TWj5n1-PUfx)] +- **OrderedMap_Elements** : returns the key-value pairs in order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Elements)] + [[play](https://go.dev/play/p/4BHG4kKz6bB)] +- **OrderedMap_Len** : returns the number of key-value pairs. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Len)] + [[play](https://go.dev/play/p/cLe6z2VX5N-)] +- **OrderedMap_Contains** : returns true if the given key exists. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Contains)] + [[play](https://go.dev/play/p/QuwqqnzwDNX)] +- **OrderedMap_Iter** : returns a channel that yields key-value pairs in order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Iter)] + [[play](https://go.dev/play/p/tlq2tdvicPt)] +- **OrderedMap_ReverseIter** : returns a channel that yields key-value pairs in reverse order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_ReverseIter)] + [[play](https://go.dev/play/p/8Q0ssg6hZzO)] +- **OrderedMap_SortByKey** : sorts the map by key given less function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_SortByKey)] + [[play](https://go.dev/play/p/N7hjD_alZPq)] +- **OrderedMap_MarshalJSON** : implements the json.Marshaler interface. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_MarshalJSON)] + [[play](https://go.dev/play/p/C-wAwydIAC7)] +- **OrderedMap_UnmarshalJSON** : implements the json.Unmarshaler interface. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_UnmarshalJSON)] + [[play](https://go.dev/play/p/t_pkwerIRVx)] +- **NewConcurrentMap** : creates a ConcurrentMap with specific shard count. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#NewConcurrentMap)] + [[play](https://go.dev/play/p/3PenTPETJT0)] +- **ConcurrentMap_Set** : set the value for a key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Set)] + [[play](https://go.dev/play/p/3PenTPETJT0)] +- **ConcurrentMap_Get** : get the value stored in the map for a key, or nil if no. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Get)] + [[play](https://go.dev/play/p/3PenTPETJT0)] +- **ConcurrentMap_GetOrSet** : returns the existing value for the key if present. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_GetOrSet)] + [[play](https://go.dev/play/p/aDcDApOK01a)] +- **ConcurrentMap_Delete** : delete the value for a key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Delete)] + [[play](https://go.dev/play/p/uTIJZYhpVMS)] +- **ConcurrentMap_GetAndDelete** :returns the existing value for the key if present and then delete the value for the key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_GetAndDelete)] + [[play](https://go.dev/play/p/ZyxeIXSZUiM)] +- **ConcurrentMap_Has** : checks if map has the value for a key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Has)] + [[play](https://go.dev/play/p/C8L4ul9TVwf)] +- **ConcurrentMap_Range** : calls iterator sequentially for each key and value present in each of the shards in the map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Range)] + [[play](https://go.dev/play/p/iqcy7P8P0Pr)] +- **SortByKey** : sorts the map by its keys and returns a new map with sorted keys. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#SortByKey)] + [[play](https://go.dev/play/p/PVdmBSnm6P_W)] +- **GetOrDefault** : returns the value of the given key or a default value if the key is not present. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#GetOrDefault)] + [[play](https://go.dev/play/p/99QjSYSBdiM)] +- **FindValuesBy** : returns a slice of values from the map that satisfy the given predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FindValuesBy)] + [[play](https://go.dev/play/p/bvNwNBZDm6v)] +- **ToMarkdownTable** : Convert a map slice data to a Markdown table string. It supports custom header display names and column display order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToMarkdownTable)] + [[play](https://go.dev/play/p/w_pSLfeyEB5)]

15. Mathutil package implements some functions for math calculation.        index

@@ -1241,108 +1241,108 @@ import "github.com/duke-git/lancet/v2/mathutil" #### Function list: -- **Average** :return average value of numbers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Average)] - [[play](https://go.dev/play/p/Vv7LBwER-pz)] -- **Exponent** : calculate x^n for int64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Exponent)] - [[play](https://go.dev/play/p/uF3HGNPk8wr)] -- **Fibonacci** :calculate fibonacci number before n for int. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Fibonacci)] - [[play](https://go.dev/play/p/IscseUNMuUc)] -- **Factorial** : calculate x! for uint. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Factorial)] - [[play](https://go.dev/play/p/tt6LdOK67Nx)] -- **Max** : return maximum value of numbers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Max)] - [[play](https://go.dev/play/p/cN8DHI0rTkH)] -- **MaxBy** : return the maximum value of a slice using the given comparator function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#MaxBy)] - [[play](https://go.dev/play/p/pbe2MT-7DV2)] -- **Min** : return minimum value of numbers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Min)] - [[play](https://go.dev/play/p/21BER_mlGUj)] -- **MinBy** : return the minimum value of a slice using the given comparator function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#MinBy)] - [[play](https://go.dev/play/p/N9qgYg_Ho6f)] -- **Percent** : calculate the percentage of value to total. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Percent)] - [[play](https://go.dev/play/p/s0NdFCtwuyd)] -- **RoundToFloat** : round up to n decimal places for float64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RoundToFloat)] - [[play](https://go.dev/play/p/ghyb528JRJL)] -- **RoundToString** : round up to n decimal places for float64, return string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RoundToString)] - [[play](https://go.dev/play/p/kZwpBRAcllO)] -- **TruncRound** : round off n decimal places for int64. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#TruncRound)] - [[play](https://go.dev/play/p/aumarSHIGzP)] -- **CeilToFloat** : round float up n decimal places. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#CeilToFloat)] - [[play](https://go.dev/play/p/8hOeSADZPCo)] -- **CeilToString** : round float up n decimal places, then conver to string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#CeilToString)] - [[play](https://go.dev/play/p/wy5bYEyUKKG)] -- **FloorToFloat** : round float down n decimal places. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#FloorToFloat)] - [[play](https://go.dev/play/p/vbCBrQHZEED)] -- **FloorToString** : round float down n decimal places, then conver to string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#FloorToString)] - [[play](https://go.dev/play/p/Qk9KPd2IdDb)] -- **Range** : Creates a slice of numbers from start with specified count, element step is 1. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Range)] - [[play](https://go.dev/play/p/9ke2opxa8ZP)] -- **RangeWithStep** : Creates a slice of numbers from start to end with specified step. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Range)] - [[play](https://go.dev/play/p/akLWz0EqOSM)] -- **AngleToRadian** : converts angle value to radian value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#AngleToRadian)] - [[play](https://go.dev/play/p/CIvlICqrHql)] -- **RadianToAngle** : converts radian value to angle value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RadianToAngle)] - [[play](https://go.dev/play/p/dQtmOTUOMgi)] -- **PointDistance** : get two points distance. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#PointDistance)] - [[play](https://go.dev/play/p/RrG4JIaziM8)] -- **IsPrime** : checks if number is prime number. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#IsPrime)] - [[play](https://go.dev/play/p/Rdd8UTHZJ7u)] -- **GCD** : return greatest common divisor (GCD) of integers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#GCD)] - [[play](https://go.dev/play/p/CiEceLSoAKB)] -- **LCM** : return Least Common Multiple (LCM) of integers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#LCM)] - [[play](https://go.dev/play/p/EjcZxfY7G_g)] -- **Cos** : return the cosine of the radian argument. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Cos)] - [[play](https://go.dev/play/p/Sm89LoIfvFq)] -- **Sin** : return the sine of the radian argument. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sin)] - [[play](https://go.dev/play/p/TWMQlMywDsP)] -- **Log** : returns the logarithm of base n. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Log)] - [[play](https://go.dev/play/p/_d4bi8oyhat)] -- **Sum** : return sum of passed numbers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sum)] - [[play](https://go.dev/play/p/1To2ImAMJA7)] -- **Abs** : returns the absolute value of param number. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sum)] - [[play](https://go.dev/play/p/fsyBh1Os-1d)] -- **Div** : returns the result of x divided by y. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Div)] - [[play](https://go.dev/play/p/WLxDdGXXYat)] -- **Variance** : returns the variance of numbers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Variance)] - [[play](https://go.dev/play/p/uHuV4YgXf8F)] -- **StdDev** : returns the standard deviation of numbers. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#StdDev)] - [[play](https://go.dev/play/p/FkNZDXvHD2l)] -- **Permutation** : calculates P(n, k). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Permutation)] - [[play](https://go.dev/play/p/MgobwH_FOxj)] -- **Combination** : calculates C(n, k). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Combination)] - [[play](https://go.dev/play/p/ENFQRDQUFi9)] +- **Average** :return average value of numbers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Average)] + [[play](https://go.dev/play/p/Vv7LBwER-pz)] +- **Exponent** : calculate x^n for int64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Exponent)] + [[play](https://go.dev/play/p/uF3HGNPk8wr)] +- **Fibonacci** :calculate fibonacci number before n for int. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Fibonacci)] + [[play](https://go.dev/play/p/IscseUNMuUc)] +- **Factorial** : calculate x! for uint. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Factorial)] + [[play](https://go.dev/play/p/tt6LdOK67Nx)] +- **Max** : return maximum value of numbers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Max)] + [[play](https://go.dev/play/p/cN8DHI0rTkH)] +- **MaxBy** : return the maximum value of a slice using the given comparator function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#MaxBy)] + [[play](https://go.dev/play/p/pbe2MT-7DV2)] +- **Min** : return minimum value of numbers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Min)] + [[play](https://go.dev/play/p/21BER_mlGUj)] +- **MinBy** : return the minimum value of a slice using the given comparator function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#MinBy)] + [[play](https://go.dev/play/p/N9qgYg_Ho6f)] +- **Percent** : calculate the percentage of value to total. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Percent)] + [[play](https://go.dev/play/p/s0NdFCtwuyd)] +- **RoundToFloat** : round up to n decimal places for float64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RoundToFloat)] + [[play](https://go.dev/play/p/ghyb528JRJL)] +- **RoundToString** : round up to n decimal places for float64, return string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RoundToString)] + [[play](https://go.dev/play/p/kZwpBRAcllO)] +- **TruncRound** : round off n decimal places for int64. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#TruncRound)] + [[play](https://go.dev/play/p/aumarSHIGzP)] +- **CeilToFloat** : round float up n decimal places. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#CeilToFloat)] + [[play](https://go.dev/play/p/8hOeSADZPCo)] +- **CeilToString** : round float up n decimal places, then conver to string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#CeilToString)] + [[play](https://go.dev/play/p/wy5bYEyUKKG)] +- **FloorToFloat** : round float down n decimal places. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#FloorToFloat)] + [[play](https://go.dev/play/p/vbCBrQHZEED)] +- **FloorToString** : round float down n decimal places, then conver to string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#FloorToString)] + [[play](https://go.dev/play/p/Qk9KPd2IdDb)] +- **Range** : Creates a slice of numbers from start with specified count, element step is 1. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Range)] + [[play](https://go.dev/play/p/9ke2opxa8ZP)] +- **RangeWithStep** : Creates a slice of numbers from start to end with specified step. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Range)] + [[play](https://go.dev/play/p/akLWz0EqOSM)] +- **AngleToRadian** : converts angle value to radian value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#AngleToRadian)] + [[play](https://go.dev/play/p/CIvlICqrHql)] +- **RadianToAngle** : converts radian value to angle value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RadianToAngle)] + [[play](https://go.dev/play/p/dQtmOTUOMgi)] +- **PointDistance** : get two points distance. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#PointDistance)] + [[play](https://go.dev/play/p/RrG4JIaziM8)] +- **IsPrime** : checks if number is prime number. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#IsPrime)] + [[play](https://go.dev/play/p/Rdd8UTHZJ7u)] +- **GCD** : return greatest common divisor (GCD) of integers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#GCD)] + [[play](https://go.dev/play/p/CiEceLSoAKB)] +- **LCM** : return Least Common Multiple (LCM) of integers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#LCM)] + [[play](https://go.dev/play/p/EjcZxfY7G_g)] +- **Cos** : return the cosine of the radian argument. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Cos)] + [[play](https://go.dev/play/p/Sm89LoIfvFq)] +- **Sin** : return the sine of the radian argument. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sin)] + [[play](https://go.dev/play/p/TWMQlMywDsP)] +- **Log** : returns the logarithm of base n. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Log)] + [[play](https://go.dev/play/p/_d4bi8oyhat)] +- **Sum** : return sum of passed numbers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sum)] + [[play](https://go.dev/play/p/1To2ImAMJA7)] +- **Abs** : returns the absolute value of param number. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sum)] + [[play](https://go.dev/play/p/fsyBh1Os-1d)] +- **Div** : returns the result of x divided by y. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Div)] + [[play](https://go.dev/play/p/WLxDdGXXYat)] +- **Variance** : returns the variance of numbers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Variance)] + [[play](https://go.dev/play/p/uHuV4YgXf8F)] +- **StdDev** : returns the standard deviation of numbers. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#StdDev)] + [[play](https://go.dev/play/p/FkNZDXvHD2l)] +- **Permutation** : calculates P(n, k). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Permutation)] + [[play](https://go.dev/play/p/MgobwH_FOxj)] +- **Combination** : calculates C(n, k). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Combination)] + [[play](https://go.dev/play/p/ENFQRDQUFi9)]

16. Netutil package contains functions to get net information and send http request.        index

@@ -1352,76 +1352,76 @@ import "github.com/duke-git/lancet/v2/netutil" #### Function list: -- **ConvertMapToQueryString** : convert map to sorted url query string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#ConvertMapToQueryString)] - [[play](https://go.dev/play/p/jnNt_qoSnRi)] -- **EncodeUrl** : encode url(?a=1&b=[2] -> ?a=1&b=%5B2%5D). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#EncodeUrl)] - [[play](https://go.dev/play/p/bsZ6BRC4uKI)] -- **GetInternalIp** : return internal ipv4. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetInternalIp)] - [[play](https://go.dev/play/p/5mbu-gFp7ei)] -- **GetIps** : return all ipv4 of current system. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetIps)] - [[play](https://go.dev/play/p/NUFfcEmukx1)] -- **GetMacAddrs** : return mac address of current system. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetMacAddrs)] - [[play](https://go.dev/play/p/Rq9UUBS_Xp1)] -- **GetPublicIpInfo** : return [public ip information](http://ip-api.com/json/). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetPublicIpInfo)] - [[play](https://go.dev/play/p/YDxIfozsRHR)] -- **GetRequestPublicIp** : return the http request public ip. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetRequestPublicIp)] - [[play](https://go.dev/play/p/kxU-YDc_eBo)] -- **IsPublicIP** : verify a ip is public or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsPublicIP)] - [[play](https://go.dev/play/p/nmktSQpJZnn)] -- **IsInternalIP** : verify an ip is intranet or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsInternalIP)] - [[play](https://go.dev/play/p/sYGhXbgO4Cb)] -- **HttpRequest** : a composed http request used for HttpClient send request. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpRequest)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **HttpClient** : a http client tool, used for sending http request - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpClient)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **SendRequest** : send http request. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#SendRequest)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **DecodeResponse** : decode http response into target object. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#DecodeResponse)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **StructToUrlValues** : convert struct to url values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#StructToUrlValues)] - [[play](https://go.dev/play/p/pFqMkM40w9z)] -- **HttpGetdeprecated** : send http get request. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpGet)] -- **HttpDeletedeprecated** : send http delete request. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpDelete)] -- **HttpPostdeprecated** : send http post request. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPost)] -- **HttpPutdeprecated** : send http put request. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPut)] -- **HttpPatchdeprecated** : send http patch request. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPatch)] -- **ParseHttpResponse** : decode http response into target object. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#ParseHttpResponse)] -- **DownloadFile** : download the file exist in url to a local file. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#DownloadFile)] -- **UploadFile** : upload the file to a server. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#UploadFile)] -- **IsPingConnected** : checks if can ping the specified host or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsPingConnected)] - [[play](https://go.dev/play/p/q8OzTijsA87)] -- **IsTelnetConnected** : checks if can if can telnet the specified host or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsTelnetConnected)] - [[play](https://go.dev/play/p/yiLCGtQv_ZG)] -- **BuildUrl** : builds a URL from the given params. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#BuildUrl)] - [[play](https://go.dev/play/p/JLXl1hZK7l4)] -- **AddQueryParams** : adds query parameters to the given URL. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#AddQueryParams)] - [[play](https://go.dev/play/p/JLXl1hZK7l4)] +- **ConvertMapToQueryString** : convert map to sorted url query string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#ConvertMapToQueryString)] + [[play](https://go.dev/play/p/jnNt_qoSnRi)] +- **EncodeUrl** : encode url(?a=1&b=[2] -> ?a=1&b=%5B2%5D). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#EncodeUrl)] + [[play](https://go.dev/play/p/bsZ6BRC4uKI)] +- **GetInternalIp** : return internal ipv4. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetInternalIp)] + [[play](https://go.dev/play/p/5mbu-gFp7ei)] +- **GetIps** : return all ipv4 of current system. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetIps)] + [[play](https://go.dev/play/p/NUFfcEmukx1)] +- **GetMacAddrs** : return mac address of current system. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetMacAddrs)] + [[play](https://go.dev/play/p/Rq9UUBS_Xp1)] +- **GetPublicIpInfo** : return [public ip information](http://ip-api.com/json/). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetPublicIpInfo)] + [[play](https://go.dev/play/p/YDxIfozsRHR)] +- **GetRequestPublicIp** : return the http request public ip. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetRequestPublicIp)] + [[play](https://go.dev/play/p/kxU-YDc_eBo)] +- **IsPublicIP** : verify a ip is public or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsPublicIP)] + [[play](https://go.dev/play/p/nmktSQpJZnn)] +- **IsInternalIP** : verify an ip is intranet or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsInternalIP)] + [[play](https://go.dev/play/p/sYGhXbgO4Cb)] +- **HttpRequest** : a composed http request used for HttpClient send request. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpRequest)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **HttpClient** : a http client tool, used for sending http request + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpClient)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **SendRequest** : send http request. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#SendRequest)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **DecodeResponse** : decode http response into target object. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#DecodeResponse)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **StructToUrlValues** : convert struct to url values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#StructToUrlValues)] + [[play](https://go.dev/play/p/pFqMkM40w9z)] +- **HttpGetdeprecated** : send http get request. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpGet)] +- **HttpDeletedeprecated** : send http delete request. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpDelete)] +- **HttpPostdeprecated** : send http post request. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPost)] +- **HttpPutdeprecated** : send http put request. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPut)] +- **HttpPatchdeprecated** : send http patch request. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPatch)] +- **ParseHttpResponse** : decode http response into target object. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#ParseHttpResponse)] +- **DownloadFile** : download the file exist in url to a local file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#DownloadFile)] +- **UploadFile** : upload the file to a server. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#UploadFile)] +- **IsPingConnected** : checks if can ping the specified host or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsPingConnected)] + [[play](https://go.dev/play/p/q8OzTijsA87)] +- **IsTelnetConnected** : checks if can if can telnet the specified host or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsTelnetConnected)] + [[play](https://go.dev/play/p/yiLCGtQv_ZG)] +- **BuildUrl** : builds a URL from the given params. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#BuildUrl)] + [[play](https://go.dev/play/p/JLXl1hZK7l4)] +- **AddQueryParams** : adds query parameters to the given URL. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#AddQueryParams)] + [[play](https://go.dev/play/p/JLXl1hZK7l4)]

17. Pointer package contains some util functions to operate go pointer.        index

@@ -1431,21 +1431,21 @@ import "github.com/duke-git/lancet/v2/pointer" #### Function list: -- **ExtractPointer** : return the underlying value by the given interface type. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#ExtractPointer)] - [[play](https://go.dev/play/p/D7HFjeWU2ZP)] -- **Of** : return a pointer to the value `v`. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#Of)] - [[play](https://go.dev/play/p/HFd70x4DrMj)] -- **Unwrap** : return the value from the pointer. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#Unwrap)] - [[play](https://go.dev/play/p/cgeu3g7cjWb)] -- **UnwrapOr** : UnwrapOr returns the value from the pointer or fallback if the pointer is nil. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#UnwrapOr)] - [[play](https://go.dev/play/p/mmNaLC38W8C)] -- **UnwarpOrDefault** : UnwarpOrDefault returns the value from the pointer or the default value if the pointer is nil. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#UnwrapOrDefault)] - [[play](https://go.dev/play/p/ZnGIHf8_o4E)] +- **ExtractPointer** : return the underlying value by the given interface type. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#ExtractPointer)] + [[play](https://go.dev/play/p/D7HFjeWU2ZP)] +- **Of** : return a pointer to the value `v`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#Of)] + [[play](https://go.dev/play/p/HFd70x4DrMj)] +- **Unwrap** : return the value from the pointer. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#Unwrap)] + [[play](https://go.dev/play/p/cgeu3g7cjWb)] +- **UnwrapOr** : UnwrapOr returns the value from the pointer or fallback if the pointer is nil. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#UnwrapOr)] + [[play](https://go.dev/play/p/mmNaLC38W8C)] +- **UnwarpOrDefault** : UnwarpOrDefault returns the value from the pointer or the default value if the pointer is nil. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#UnwrapOrDefault)] + [[play](https://go.dev/play/p/ZnGIHf8_o4E)]

18. Random package implements some basic functions to generate random int and string.        index

@@ -1455,63 +1455,63 @@ import "github.com/duke-git/lancet/v2/random" #### Function list: -- **RandBytes** : generate random byte slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBytes)] - [[play](https://go.dev/play/p/EkiLESeXf8d)] -- **RandInt** : generate random int number between min and max. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandInt)] - [[play](https://go.dev/play/p/pXyyAAI5YxD)] -- **RandString** : generate random string of specific length. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandString)] - [[play](https://go.dev/play/p/W2xvRUXA7Mi)] -- **RandUpper** : generate a random upper case string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandUpper)] - [[play](https://go.dev/play/p/29QfOh0DVuh)] -- **RandLower** : generate a random lower case string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandLower)] - [[play](https://go.dev/play/p/XJtZ471cmtI)] -- **RandNumeral** : generate a random numeral string of specific length. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumeral)] - [[play](https://go.dev/play/p/g4JWVpHsJcf)] -- **RandNumeralOrLetter** : generate a random numeral or letter string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumeralOrLetter)] - [[play](https://go.dev/play/p/19CEQvpx2jD)] -- **UUIdV4** : generate a random UUID of version 4 according to RFC 4122. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#UUIdV4)] - [[play](https://go.dev/play/p/_Z9SFmr28ft)] -- **RandUniqueIntSlice** : generate a slice of random int that do not repeat. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandUniqueIntSlice)] - [[play](https://go.dev/play/p/uBkRSOz73Ec)] -- **RandSymbolChar** : generate a random symbol char of specified length. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandSymbolChar)] - [[play](https://go.dev/play/p/Im6ZJxAykOm)] -- **RandFloat** : generate a random float64 number between [min, max) with specific precision. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloat)] - [[play](https://go.dev/play/p/zbD_tuobJtr)] -- **RandFloats** : generate a slice of random float64 numbers that do not repeat. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloats)] - [[play](https://go.dev/play/p/I3yndUQ-rhh)] -- **RandStringSlice** : generate a slice of random string of length strLen based on charset. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandStringSlice)] - [[play](https://go.dev/play/p/2_-PiDv3tGn)] -- **RandBool** : generate a random boolean value (true or false). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBool)] - [[play](https://go.dev/play/p/to6BLc26wBv)] -- **RandBoolSlice** : generate a random boolean slice of specified length. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBoolSlice)] - [[play](https://go.dev/play/p/o-VSjPjnILI)] -- **RandIntSlice** : generate a slice of random int. Number range in [min, max) - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandIntSlice)] - [[play](https://go.dev/play/p/GATTQ5xTEG8)] -- **RandFromGivenSlice** : generate a random element from given slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFromGivenSlice)] - [[play](https://go.dev/play/p/UrkWueF6yYo)] -- **RandSliceFromGivenSlice** : generate a random slice of length num from given slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandSliceFromGivenSlice)] - [[play](https://go.dev/play/p/68UikN9d6VT)] -- **RandNumberOfLength** : generates a random int number of specified length. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumberOfLength)] - [[play](https://go.dev/play/p/oyZbuV7bu7b)] +- **RandBytes** : generate random byte slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBytes)] + [[play](https://go.dev/play/p/EkiLESeXf8d)] +- **RandInt** : generate random int number between min and max. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandInt)] + [[play](https://go.dev/play/p/pXyyAAI5YxD)] +- **RandString** : generate random string of specific length. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandString)] + [[play](https://go.dev/play/p/W2xvRUXA7Mi)] +- **RandUpper** : generate a random upper case string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandUpper)] + [[play](https://go.dev/play/p/29QfOh0DVuh)] +- **RandLower** : generate a random lower case string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandLower)] + [[play](https://go.dev/play/p/XJtZ471cmtI)] +- **RandNumeral** : generate a random numeral string of specific length. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumeral)] + [[play](https://go.dev/play/p/g4JWVpHsJcf)] +- **RandNumeralOrLetter** : generate a random numeral or letter string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumeralOrLetter)] + [[play](https://go.dev/play/p/19CEQvpx2jD)] +- **UUIdV4** : generate a random UUID of version 4 according to RFC 4122. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#UUIdV4)] + [[play](https://go.dev/play/p/_Z9SFmr28ft)] +- **RandUniqueIntSlice** : generate a slice of random int that do not repeat. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandUniqueIntSlice)] + [[play](https://go.dev/play/p/uBkRSOz73Ec)] +- **RandSymbolChar** : generate a random symbol char of specified length. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandSymbolChar)] + [[play](https://go.dev/play/p/Im6ZJxAykOm)] +- **RandFloat** : generate a random float64 number between [min, max) with specific precision. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloat)] + [[play](https://go.dev/play/p/zbD_tuobJtr)] +- **RandFloats** : generate a slice of random float64 numbers that do not repeat. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloats)] + [[play](https://go.dev/play/p/I3yndUQ-rhh)] +- **RandStringSlice** : generate a slice of random string of length strLen based on charset. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandStringSlice)] + [[play](https://go.dev/play/p/2_-PiDv3tGn)] +- **RandBool** : generate a random boolean value (true or false). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBool)] + [[play](https://go.dev/play/p/to6BLc26wBv)] +- **RandBoolSlice** : generate a random boolean slice of specified length. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBoolSlice)] + [[play](https://go.dev/play/p/o-VSjPjnILI)] +- **RandIntSlice** : generate a slice of random int. Number range in [min, max) + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandIntSlice)] + [[play](https://go.dev/play/p/GATTQ5xTEG8)] +- **RandFromGivenSlice** : generate a random element from given slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFromGivenSlice)] + [[play](https://go.dev/play/p/UrkWueF6yYo)] +- **RandSliceFromGivenSlice** : generate a random slice of length num from given slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandSliceFromGivenSlice)] + [[play](https://go.dev/play/p/68UikN9d6VT)] +- **RandNumberOfLength** : generates a random int number of specified length. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumberOfLength)] + [[play](https://go.dev/play/p/oyZbuV7bu7b)]

19. Retry package is for executing a function repeatedly until it was successful or canceled by the context.        index

@@ -1521,32 +1521,32 @@ import "github.com/duke-git/lancet/v2/retry" #### Function list: -- **Context** : set retry context config option. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#Context)] - [[play](https://go.dev/play/p/xnAOOXv9GkS)] -- **Retry** : executes the retryFunc repeatedly until it was successful or canceled by the context. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#Retry)] - [[play](https://go.dev/play/p/nk2XRmagfVF)] -- **RetryFunc** : function that retry executes. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryFunc)] - [[play](https://go.dev/play/p/nk2XRmagfVF)] -- **RetryDuration** : set duration of retry - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryDuration)] - [[play](https://go.dev/play/p/nk2XRmagfVF)] -- **RetryTimes** : set times of retry. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryTimes)] - [[play](https://go.dev/play/p/ssfVeU2SwLO)] -- **BackoffStrategy** : An interface that defines a method for calculating backoff intervals. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#BackoffStrategy)] -- **RetryWithCustomBackoff** : set abitary custom backoff strategy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithCustomBackoff)] - [[play](https://go.dev/play/p/jIm_o2vb5Y4)] -- **RetryWithLinearBackoff** : set linear strategy backoff. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithLinearBackoff)] - [[play](https://go.dev/play/p/PDet2ZQZwcB)] -- **RetryWithExponentialWithJitterBackoff** : set exponential strategy backoff. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithExponentialWithJitterBackoff)] - [[play](https://go.dev/play/p/xp1avQmn16X)] +- **Context** : set retry context config option. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#Context)] + [[play](https://go.dev/play/p/xnAOOXv9GkS)] +- **Retry** : executes the retryFunc repeatedly until it was successful or canceled by the context. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#Retry)] + [[play](https://go.dev/play/p/nk2XRmagfVF)] +- **RetryFunc** : function that retry executes. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryFunc)] + [[play](https://go.dev/play/p/nk2XRmagfVF)] +- **RetryDuration** : set duration of retry + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryDuration)] + [[play](https://go.dev/play/p/nk2XRmagfVF)] +- **RetryTimes** : set times of retry. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryTimes)] + [[play](https://go.dev/play/p/ssfVeU2SwLO)] +- **BackoffStrategy** : An interface that defines a method for calculating backoff intervals. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#BackoffStrategy)] +- **RetryWithCustomBackoff** : set abitary custom backoff strategy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithCustomBackoff)] + [[play](https://go.dev/play/p/jIm_o2vb5Y4)] +- **RetryWithLinearBackoff** : set linear strategy backoff. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithLinearBackoff)] + [[play](https://go.dev/play/p/PDet2ZQZwcB)] +- **RetryWithExponentialWithJitterBackoff** : set exponential strategy backoff. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithExponentialWithJitterBackoff)] + [[play](https://go.dev/play/p/xp1avQmn16X)]

20. Slice contains some functions to manipulate slice.        index

@@ -1556,269 +1556,269 @@ import "github.com/duke-git/lancet/v2/slice" #### Function list: -- **AppendIfAbsent** : if the item is absent,append it to the slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#AppendIfAbsent)] - [[play](https://go.dev/play/p/GNdv7Jg2Taj)] -- **Contain** : check if the value is in the slice or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Contain)] - [[play](https://go.dev/play/p/_454yEHcNjf)] -- **ContainBy** : returns true if predicate function return true. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainBy)] - [[play](https://go.dev/play/p/49tkHfX4GNc)] -- **ContainSubSlice** : check if the slice contain a given subslice or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainSubSlice)] - [[play](https://go.dev/play/p/bcuQ3UT6Sev)] -- **ContainAny** : check if the slice contains any element from the targets slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainAny)] - [[play](https://go.dev/play/p/4xoxhc9XSSw)] -- **Chunk** : creates a slice of elements split into groups the length of size. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Chunk)] - [[play](https://go.dev/play/p/b4Pou5j2L_C)] -- **Compact** : creates an slice with all falsy values removed. The values false, nil, 0, and "" are falsy. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Compact)] - [[play](https://go.dev/play/p/pO5AnxEr3TK)] -- **Concat** : creates a new slice concatenating slice with any additional slices. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Concat)] - [[play](https://go.dev/play/p/gPt-q7zr5mk)] -- **Count** : returns the number of occurrences of the given item in the slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Count)] - [[play](https://go.dev/play/p/Mj4oiEnQvRJ)] -- **CountBy** : iterates over elements of slice with predicate function, returns the number of all matched elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#CountBy)] - [[play](https://go.dev/play/p/tHOccTMDZCC)] -- **Difference** : creates an slice of whose element in slice but not in compared slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Difference)] - [[play](https://go.dev/play/p/VXvadzLzhDa)] -- **DifferenceBy** : accepts iteratee which is invoked for each element of slice and values to generate the criterion by which they're compared. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DifferenceBy)] - [[play](https://go.dev/play/p/DiivgwM5OnC)] -- **DifferenceWith** : accepts comparator which is invoked to compare elements of slice to values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DifferenceWith)] - [[play](https://go.dev/play/p/v2U2deugKuV)] -- **DeleteAt** : delete the element of slice at index. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DeleteAt)] - [[play](https://go.dev/play/p/800B1dPBYyd)] -- **DeleteRange** : delete the element of slice from start index to end index(exclude). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DeleteRange)] - [[play](https://go.dev/play/p/945HwiNrnle)] -- **Drop** : drop n elements from the start of a slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Drop)] - [[play](https://go.dev/play/p/jnPO2yQsT8H)] -- **DropRight** : drop n elements from the end of a slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropRight)] - [[play](https://go.dev/play/p/8bcXvywZezG)] -- **DropWhile** : drop n elements from the start of a slice while predicate function returns true. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropWhile)] - [[play](https://go.dev/play/p/4rt252UV_qs)] -- **DropRightWhile** : drop n elements from the end of a slice while predicate function returns true. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropRightWhile)] - [[play](https://go.dev/play/p/6wyK3zMY56e)] -- **Equal** : checks if two slices are equal: the same length and all elements' order and value are equal. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Equal)] - [[play](https://go.dev/play/p/WcRQJ37ifPa)] -- **EqualWith** : checks if two slices are equal with comparator func. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#EqualWith)] - [[play](https://go.dev/play/p/b9iygtgsHI1)] -- **EqualUnordered** : Checks if two slices are equal: the same length and all elements value are equal (unordered). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#EqualUnordered)] - [[play](https://go.dev/play/p/n8fSc2w8ZgX)] -- **Every** : return true if all of the values in the slice pass the predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Every)] - [[play](https://go.dev/play/p/R8U6Sl-j8cD)] -- **Filter** : iterates over elements of slice, returning an slice of all elements pass the predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Filter)] - [[play](https://go.dev/play/p/SdPna-7qK4T)] -- **FilterMap** : returns a slice which apply both filtering and mapping to the given slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FilterMap)] - [[play](https://go.dev/play/p/J94SZ_9MiIe)] -- **Finddeprecated** : iterates over elements of slice, returning the first one that passes a truth test on predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Find)] - [[play](https://go.dev/play/p/CBKeBoHVLgq)] -- **FindBy** : iterates over elements of slice, returning the first one that passes a truth test on predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindBy)] - [[play](https://go.dev/play/p/n1lysBYl-GB)] -- **FindLastdeprecated** : return the last item that passes a truth test on predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindLast)] - [[play](https://go.dev/play/p/FFDPV_j7URd)] -- **FindLastBy** : iterates over elements of slice, returning the last one that passes a truth test on predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindLastBy)] - [[play](https://go.dev/play/p/8iqomzyCl_s)] -- **Flatten** : flattens slice one level. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Flatten)] - [[play](https://go.dev/play/p/hYa3cBEevtm)] -- **FlattenDeep** : flattens slice recursive to one level. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FlattenDeep)] - [[play](https://go.dev/play/p/yjYNHPyCFaF)] -- **FlatMap** : manipulates a slice and transforms and flattens it to a slice of another type. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FlatMap)] - [[play](https://go.dev/play/p/_QARWlWs1N_F)] -- **ForEach** : iterates over elements of slice and invokes function for each element. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEach)] - [[play](https://go.dev/play/p/DrPaa4YsHRF)] -- **ForEachWithBreak** : iterates over elements of slice and invokes function for each element, when iteratee return false, will break the for each loop. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEachWithBreak)] - [[play](https://go.dev/play/p/qScs39f3D9W)] -- **ForEachConcurrent** : applies the iteratee function to each item in the slice concurrently. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEachConcurrent)] - [[play](https://go.dev/play/p/kT4XW7DKVoV)] -- **GroupBy** : iterate over elements of the slice, each element will be group by criteria, returns two slices. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#GroupBy)] - [[play](https://go.dev/play/p/QVkPxzPR0iA)] -- **GroupWith** : return a map composed of keys generated from the results of running each element of slice thru iteratee. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#GroupWith)] - [[play](https://go.dev/play/p/ApCvMNTLO8a)] -- **IntSlicedeprecated** : convert param to int slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IntSlice)] - [[play](https://go.dev/play/p/FdQXF0Vvqs-)] -- **InterfaceSlicedeprecated** : convert param to interface slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#InterfaceSlice)] - [[play](https://go.dev/play/p/FdQXF0Vvqs-)] -- **Intersection** : creates a slice of unique elements that included by all slices. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Intersection)] - [[play](https://go.dev/play/p/anJXfB5wq_t)] -- **InsertAt** : insert the value or other slice into slice at index. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#InsertAt)] - [[play](https://go.dev/play/p/hMLNxPEGJVE)] -- **IndexOf** : returns the index at which the first occurrence of an item is found in a slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IndexOf)] - [[play](https://go.dev/play/p/MRN1f0FpABb)] -- **LastIndexOf** : returns the index at which the last occurrence of the item is found in a slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#LastIndexOf)] - [[play](https://go.dev/play/p/DokM4cf1IKH)] -- **Map** : creates an slice of values by running each element of slice thru iteratee function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Map)] - [[play](https://go.dev/play/p/biaTefqPquw)] -- **MapConcurrent** : applies the iteratee function to each item in the slice by concrrent. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#MapConcurrent)] - [[play](https://go.dev/play/p/H1ehfPkPen0)] -- **Merge** : merge all given slices into one slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Merge)] - [[play](https://go.dev/play/p/lbjFp784r9N)] -- **Reverse** : return slice of element order is reversed to the given slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Reverse)] - [[play](https://go.dev/play/p/8uI8f1lwNrQ)] -- **Reducedeprecated** : creates an slice of values by running each element of slice thru iteratee function.(Deprecated: use ReduceBy) - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Reduce)] - [[play](https://go.dev/play/p/_RfXJJWIsIm)] -- **ReduceBy** : produces a value from slice by accumulating the result of each element as passed through the reducer function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceBy)] - [[play](https://go.dev/play/p/YKDpLi7gtee)] -- **ReduceRight** : ReduceRight is like ReduceBy, but it iterates over elements of slice from right to left. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceRight)] - [[play](https://go.dev/play/p/qT9dZC03A1K)] -- **ReduceConcurrent** : reduces the slice to a single value by applying the reducer function to each item in the slice concurrently. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceConcurrent)] - [[play](https://go.dev/play/p/Tjwe6OtaG07)] -- **Replace** : returns a copy of the slice with the first n non-overlapping instances of old replaced by new. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Replace)] - [[play](https://go.dev/play/p/P5mZp7IhOFo)] -- **ReplaceAll** : returns a copy of the slice with all non-overlapping instances of old replaced by new. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReplaceAll)] - [[play](https://go.dev/play/p/CzqXMsuYUrx)] -- **Repeat** : creates a slice with length n whose elements are passed item. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Repeat)] - [[play](https://go.dev/play/p/1CbOmtgILUU)] -- **Shuffle** : shuffle the slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Shuffle)] - [[play](https://go.dev/play/p/YHvhnWGU3Ge)] -- **ShuffleCopy** : return a new slice with elements shuffled. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ShuffleCopy)] - [[play](https://go.dev/play/p/vqDa-Gs1vT0)] -- **IsAscending** : Checks if a slice is ascending order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsAscending)] - [[play](https://go.dev/play/p/9CtsFjet4SH)] -- **IsDescending** : Checks if a slice is descending order. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsDescending)] - [[play](https://go.dev/play/p/U_LljFXma14)] -- **IsSorted** : Checks if a slice is sorted (ascending or descending). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsSorted)] - [[play](https://go.dev/play/p/nCE8wPLwSA-)] -- **IsSortedByKey** : Checks if a slice is sorted by iteratee function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsSortedByKey)] - [[play](https://go.dev/play/p/tUoGB7DOHI4)] -- **Sort** : sorts a slice of any ordered type(number or string). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Sort)] - [[play](https://go.dev/play/p/V9AVjzf_4Fk)] -- **SortBy** : sorts the slice in ascending order as determined by the less function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SortBy)] - [[play](https://go.dev/play/p/DAhLQSZEumm)] -- **SortByFielddeprecated** : return sorted slice by specific field. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SortByField)] - [[play](https://go.dev/play/p/fU1prOBP9p1)] -- **Some** : return true if any of the values in the list pass the predicate function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Some)] - [[play](https://go.dev/play/p/4pO9Xf9NDGS)] -- **StringSlicedeprecated** : convert param to slice of string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#StringSlice)] - [[play](https://go.dev/play/p/W0TZDWCPFcI)] -- **SymmetricDifference** : the symmetric difference of two slice, also known as the disjunctive union. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#h42nJX5xMln)] - [[play](https://go.dev/play/p/1CbOmtgILUU)] -- **ToSlice** : returns a slices of a variable parameter transformation. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ToSlice)] - [[play](https://go.dev/play/p/YzbzVq5kscN)] -- **ToSlicePointer** : returns a pointer to the slices of a variable parameter transformation. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ToSlicePointer)] - [[play](https://go.dev/play/p/gx4tr6_VXSF)] -- **Unique** : remove duplicate elements in slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Unique)] - [[play](https://go.dev/play/p/AXw0R3ZTE6a)] -- **UniqueBy** : remove duplicate elements from the input slice based on the values returned by the iteratee function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueBy)] - [[play](https://go.dev/play/p/GY7JE4yikrl)] -- **UniqueByComparator** : remove duplicate elements from the input slice using the provided comparator function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByComparator)] - [[play](https://go.dev/play/p/rwSacr-ZHsR)] -- **UniqueByField** : remove duplicate elements in struct slice by struct field. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByField)] - [[play](https://go.dev/play/p/6cifcZSPIGu)] -- **UniqueByConcurrent** : remove duplicate elements from the slice by concurrent. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByConcurrent)] - [[play](https://go.dev/play/p/wXZ7LcYRMGL)] -- **Union** : creates a slice of unique elements, in order, from all given slices. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Union)] - [[play](https://go.dev/play/p/hfXV1iRIZOf)] -- **UnionBy** : accepts iteratee which is invoked for each element of each slice, then union slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UnionBy)] - [[play](https://go.dev/play/p/HGKHfxKQsFi)] -- **UpdateAt** : update the slice element at index. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UpdateAt)] - [[play](https://go.dev/play/p/f3mh2KloWVm)] -- **Without** : creates a slice excluding all given items. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Without)] - [[play](https://go.dev/play/p/bwhEXEypThg)] -- **KeyBy** : converts a slice to a map based on a callback function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#KeyBy)] - [[play](https://go.dev/play/p/uXod2LWD1Kg)] -- **Join** : join the slice item with specify separator. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Join)] - [[play](https://go.dev/play/p/huKzqwNDD7V)] -- **Partition** : partition all slice elements with the evaluation of the given predicate functions. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Partition)] - [[play](https://go.dev/play/p/lkQ3Ri2NQhV)] -- **Random** : get a random item of slice, return its index, when slice is empty, return -1. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Random)] - [[play](https://go.dev/play/p/UzpGQptWppw)] -- **SetToDefaultIf** : set elements to their default value if they match the given predicate. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SetToDefaultIf)] - [[play](https://go.dev/play/p/9AXGlPRC0-A)] -- **Break** : breaks a list into two parts at the point where the predicate for the first time is true. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Break)] -- **RightPadding** : adds padding to the right end of a slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#RightPadding)] - [[play](https://go.dev/play/p/0_2rlLEMBXL)] -- **LeftPadding** : adds padding to the left begin of a slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#LeftPadding)] - [[play](https://go.dev/play/p/jlQVoelLl2k)] -- **Frequency** : counts the frequency of each element in the slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Frequency)] - [[play](https://go.dev/play/p/CW3UVNdUZOq)] -- **JoinFunc** : joins the slice elements into a single string with the given separator. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#JoinFunc)] - [[play](https://go.dev/play/p/55ib3SB5fM2)] -- **ConcatBy** : concats the elements of a slice into a single value using the provided separator and connector function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ConcatBy)] - [[play](https://go.dev/play/p/6QcUpcY4UMW)] +- **AppendIfAbsent** : if the item is absent,append it to the slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#AppendIfAbsent)] + [[play](https://go.dev/play/p/GNdv7Jg2Taj)] +- **Contain** : check if the value is in the slice or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Contain)] + [[play](https://go.dev/play/p/_454yEHcNjf)] +- **ContainBy** : returns true if predicate function return true. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainBy)] + [[play](https://go.dev/play/p/49tkHfX4GNc)] +- **ContainSubSlice** : check if the slice contain a given subslice or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainSubSlice)] + [[play](https://go.dev/play/p/bcuQ3UT6Sev)] +- **ContainAny** : check if the slice contains any element from the targets slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainAny)] + [[play](https://go.dev/play/p/4xoxhc9XSSw)] +- **Chunk** : creates a slice of elements split into groups the length of size. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Chunk)] + [[play](https://go.dev/play/p/b4Pou5j2L_C)] +- **Compact** : creates an slice with all falsy values removed. The values false, nil, 0, and "" are falsy. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Compact)] + [[play](https://go.dev/play/p/pO5AnxEr3TK)] +- **Concat** : creates a new slice concatenating slice with any additional slices. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Concat)] + [[play](https://go.dev/play/p/gPt-q7zr5mk)] +- **Count** : returns the number of occurrences of the given item in the slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Count)] + [[play](https://go.dev/play/p/Mj4oiEnQvRJ)] +- **CountBy** : iterates over elements of slice with predicate function, returns the number of all matched elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#CountBy)] + [[play](https://go.dev/play/p/tHOccTMDZCC)] +- **Difference** : creates an slice of whose element in slice but not in compared slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Difference)] + [[play](https://go.dev/play/p/VXvadzLzhDa)] +- **DifferenceBy** : accepts iteratee which is invoked for each element of slice and values to generate the criterion by which they're compared. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DifferenceBy)] + [[play](https://go.dev/play/p/DiivgwM5OnC)] +- **DifferenceWith** : accepts comparator which is invoked to compare elements of slice to values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DifferenceWith)] + [[play](https://go.dev/play/p/v2U2deugKuV)] +- **DeleteAt** : delete the element of slice at index. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DeleteAt)] + [[play](https://go.dev/play/p/800B1dPBYyd)] +- **DeleteRange** : delete the element of slice from start index to end index(exclude). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DeleteRange)] + [[play](https://go.dev/play/p/945HwiNrnle)] +- **Drop** : drop n elements from the start of a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Drop)] + [[play](https://go.dev/play/p/jnPO2yQsT8H)] +- **DropRight** : drop n elements from the end of a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropRight)] + [[play](https://go.dev/play/p/8bcXvywZezG)] +- **DropWhile** : drop n elements from the start of a slice while predicate function returns true. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropWhile)] + [[play](https://go.dev/play/p/4rt252UV_qs)] +- **DropRightWhile** : drop n elements from the end of a slice while predicate function returns true. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropRightWhile)] + [[play](https://go.dev/play/p/6wyK3zMY56e)] +- **Equal** : checks if two slices are equal: the same length and all elements' order and value are equal. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Equal)] + [[play](https://go.dev/play/p/WcRQJ37ifPa)] +- **EqualWith** : checks if two slices are equal with comparator func. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#EqualWith)] + [[play](https://go.dev/play/p/b9iygtgsHI1)] +- **EqualUnordered** : Checks if two slices are equal: the same length and all elements value are equal (unordered). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#EqualUnordered)] + [[play](https://go.dev/play/p/n8fSc2w8ZgX)] +- **Every** : return true if all of the values in the slice pass the predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Every)] + [[play](https://go.dev/play/p/R8U6Sl-j8cD)] +- **Filter** : iterates over elements of slice, returning an slice of all elements pass the predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Filter)] + [[play](https://go.dev/play/p/SdPna-7qK4T)] +- **FilterMap** : returns a slice which apply both filtering and mapping to the given slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FilterMap)] + [[play](https://go.dev/play/p/J94SZ_9MiIe)] +- **Finddeprecated** : iterates over elements of slice, returning the first one that passes a truth test on predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Find)] + [[play](https://go.dev/play/p/CBKeBoHVLgq)] +- **FindBy** : iterates over elements of slice, returning the first one that passes a truth test on predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindBy)] + [[play](https://go.dev/play/p/n1lysBYl-GB)] +- **FindLastdeprecated** : return the last item that passes a truth test on predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindLast)] + [[play](https://go.dev/play/p/FFDPV_j7URd)] +- **FindLastBy** : iterates over elements of slice, returning the last one that passes a truth test on predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindLastBy)] + [[play](https://go.dev/play/p/8iqomzyCl_s)] +- **Flatten** : flattens slice one level. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Flatten)] + [[play](https://go.dev/play/p/hYa3cBEevtm)] +- **FlattenDeep** : flattens slice recursive to one level. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FlattenDeep)] + [[play](https://go.dev/play/p/yjYNHPyCFaF)] +- **FlatMap** : manipulates a slice and transforms and flattens it to a slice of another type. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FlatMap)] + [[play](https://go.dev/play/p/_QARWlWs1N_F)] +- **ForEach** : iterates over elements of slice and invokes function for each element. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEach)] + [[play](https://go.dev/play/p/DrPaa4YsHRF)] +- **ForEachWithBreak** : iterates over elements of slice and invokes function for each element, when iteratee return false, will break the for each loop. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEachWithBreak)] + [[play](https://go.dev/play/p/qScs39f3D9W)] +- **ForEachConcurrent** : applies the iteratee function to each item in the slice concurrently. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEachConcurrent)] + [[play](https://go.dev/play/p/kT4XW7DKVoV)] +- **GroupBy** : iterate over elements of the slice, each element will be group by criteria, returns two slices. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#GroupBy)] + [[play](https://go.dev/play/p/QVkPxzPR0iA)] +- **GroupWith** : return a map composed of keys generated from the results of running each element of slice thru iteratee. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#GroupWith)] + [[play](https://go.dev/play/p/ApCvMNTLO8a)] +- **IntSlicedeprecated** : convert param to int slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IntSlice)] + [[play](https://go.dev/play/p/FdQXF0Vvqs-)] +- **InterfaceSlicedeprecated** : convert param to interface slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#InterfaceSlice)] + [[play](https://go.dev/play/p/FdQXF0Vvqs-)] +- **Intersection** : creates a slice of unique elements that included by all slices. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Intersection)] + [[play](https://go.dev/play/p/anJXfB5wq_t)] +- **InsertAt** : insert the value or other slice into slice at index. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#InsertAt)] + [[play](https://go.dev/play/p/hMLNxPEGJVE)] +- **IndexOf** : returns the index at which the first occurrence of an item is found in a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IndexOf)] + [[play](https://go.dev/play/p/MRN1f0FpABb)] +- **LastIndexOf** : returns the index at which the last occurrence of the item is found in a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#LastIndexOf)] + [[play](https://go.dev/play/p/DokM4cf1IKH)] +- **Map** : creates an slice of values by running each element of slice thru iteratee function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Map)] + [[play](https://go.dev/play/p/biaTefqPquw)] +- **MapConcurrent** : applies the iteratee function to each item in the slice by concrrent. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#MapConcurrent)] + [[play](https://go.dev/play/p/H1ehfPkPen0)] +- **Merge** : merge all given slices into one slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Merge)] + [[play](https://go.dev/play/p/lbjFp784r9N)] +- **Reverse** : return slice of element order is reversed to the given slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Reverse)] + [[play](https://go.dev/play/p/8uI8f1lwNrQ)] +- **Reducedeprecated** : creates an slice of values by running each element of slice thru iteratee function.(Deprecated: use ReduceBy) + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Reduce)] + [[play](https://go.dev/play/p/_RfXJJWIsIm)] +- **ReduceBy** : produces a value from slice by accumulating the result of each element as passed through the reducer function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceBy)] + [[play](https://go.dev/play/p/YKDpLi7gtee)] +- **ReduceRight** : ReduceRight is like ReduceBy, but it iterates over elements of slice from right to left. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceRight)] + [[play](https://go.dev/play/p/qT9dZC03A1K)] +- **ReduceConcurrent** : reduces the slice to a single value by applying the reducer function to each item in the slice concurrently. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceConcurrent)] + [[play](https://go.dev/play/p/Tjwe6OtaG07)] +- **Replace** : returns a copy of the slice with the first n non-overlapping instances of old replaced by new. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Replace)] + [[play](https://go.dev/play/p/P5mZp7IhOFo)] +- **ReplaceAll** : returns a copy of the slice with all non-overlapping instances of old replaced by new. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReplaceAll)] + [[play](https://go.dev/play/p/CzqXMsuYUrx)] +- **Repeat** : creates a slice with length n whose elements are passed item. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Repeat)] + [[play](https://go.dev/play/p/1CbOmtgILUU)] +- **Shuffle** : shuffle the slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Shuffle)] + [[play](https://go.dev/play/p/YHvhnWGU3Ge)] +- **ShuffleCopy** : return a new slice with elements shuffled. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ShuffleCopy)] + [[play](https://go.dev/play/p/vqDa-Gs1vT0)] +- **IsAscending** : Checks if a slice is ascending order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsAscending)] + [[play](https://go.dev/play/p/9CtsFjet4SH)] +- **IsDescending** : Checks if a slice is descending order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsDescending)] + [[play](https://go.dev/play/p/U_LljFXma14)] +- **IsSorted** : Checks if a slice is sorted (ascending or descending). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsSorted)] + [[play](https://go.dev/play/p/nCE8wPLwSA-)] +- **IsSortedByKey** : Checks if a slice is sorted by iteratee function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsSortedByKey)] + [[play](https://go.dev/play/p/tUoGB7DOHI4)] +- **Sort** : sorts a slice of any ordered type(number or string). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Sort)] + [[play](https://go.dev/play/p/V9AVjzf_4Fk)] +- **SortBy** : sorts the slice in ascending order as determined by the less function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SortBy)] + [[play](https://go.dev/play/p/DAhLQSZEumm)] +- **SortByFielddeprecated** : return sorted slice by specific field. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SortByField)] + [[play](https://go.dev/play/p/fU1prOBP9p1)] +- **Some** : return true if any of the values in the list pass the predicate function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Some)] + [[play](https://go.dev/play/p/4pO9Xf9NDGS)] +- **StringSlicedeprecated** : convert param to slice of string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#StringSlice)] + [[play](https://go.dev/play/p/W0TZDWCPFcI)] +- **SymmetricDifference** : the symmetric difference of two slice, also known as the disjunctive union. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#h42nJX5xMln)] + [[play](https://go.dev/play/p/1CbOmtgILUU)] +- **ToSlice** : returns a slices of a variable parameter transformation. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ToSlice)] + [[play](https://go.dev/play/p/YzbzVq5kscN)] +- **ToSlicePointer** : returns a pointer to the slices of a variable parameter transformation. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ToSlicePointer)] + [[play](https://go.dev/play/p/gx4tr6_VXSF)] +- **Unique** : remove duplicate elements in slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Unique)] + [[play](https://go.dev/play/p/AXw0R3ZTE6a)] +- **UniqueBy** : remove duplicate elements from the input slice based on the values returned by the iteratee function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueBy)] + [[play](https://go.dev/play/p/GY7JE4yikrl)] +- **UniqueByComparator** : remove duplicate elements from the input slice using the provided comparator function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByComparator)] + [[play](https://go.dev/play/p/rwSacr-ZHsR)] +- **UniqueByField** : remove duplicate elements in struct slice by struct field. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByField)] + [[play](https://go.dev/play/p/6cifcZSPIGu)] +- **UniqueByConcurrent** : remove duplicate elements from the slice by concurrent. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByConcurrent)] + [[play](https://go.dev/play/p/wXZ7LcYRMGL)] +- **Union** : creates a slice of unique elements, in order, from all given slices. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Union)] + [[play](https://go.dev/play/p/hfXV1iRIZOf)] +- **UnionBy** : accepts iteratee which is invoked for each element of each slice, then union slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UnionBy)] + [[play](https://go.dev/play/p/HGKHfxKQsFi)] +- **UpdateAt** : update the slice element at index. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UpdateAt)] + [[play](https://go.dev/play/p/f3mh2KloWVm)] +- **Without** : creates a slice excluding all given items. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Without)] + [[play](https://go.dev/play/p/bwhEXEypThg)] +- **KeyBy** : converts a slice to a map based on a callback function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#KeyBy)] + [[play](https://go.dev/play/p/uXod2LWD1Kg)] +- **Join** : join the slice item with specify separator. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Join)] + [[play](https://go.dev/play/p/huKzqwNDD7V)] +- **Partition** : partition all slice elements with the evaluation of the given predicate functions. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Partition)] + [[play](https://go.dev/play/p/lkQ3Ri2NQhV)] +- **Random** : get a random item of slice, return its index, when slice is empty, return -1. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Random)] + [[play](https://go.dev/play/p/UzpGQptWppw)] +- **SetToDefaultIf** : set elements to their default value if they match the given predicate. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SetToDefaultIf)] + [[play](https://go.dev/play/p/9AXGlPRC0-A)] +- **Break** : breaks a list into two parts at the point where the predicate for the first time is true. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Break)] +- **RightPadding** : adds padding to the right end of a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#RightPadding)] + [[play](https://go.dev/play/p/0_2rlLEMBXL)] +- **LeftPadding** : adds padding to the left begin of a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#LeftPadding)] + [[play](https://go.dev/play/p/jlQVoelLl2k)] +- **Frequency** : counts the frequency of each element in the slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Frequency)] + [[play](https://go.dev/play/p/CW3UVNdUZOq)] +- **JoinFunc** : joins the slice elements into a single string with the given separator. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#JoinFunc)] + [[play](https://go.dev/play/p/55ib3SB5fM2)] +- **ConcatBy** : concats the elements of a slice into a single value using the provided separator and connector function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ConcatBy)] + [[play](https://go.dev/play/p/6QcUpcY4UMW)]

21. 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.        index

@@ -1828,96 +1828,96 @@ import "github.com/duke-git/lancet/v2/stream" #### Function list: -- **Of** : creates a stream whose elements are the specified values. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Of)] - [[play](https://go.dev/play/p/jI6_iZZuVFE)] -- **FromSlice** : creates a stream from slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromSlice)] - [[play](https://go.dev/play/p/wywTO0XZtI4)] -- **FromChannel** : creates a stream from channel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromChannel)] - [[play](https://go.dev/play/p/9TZYugGMhXZ)] -- **FromRange** : creates a number stream from start to end. both start and end are included. [start, end] - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromRange)] - [[play](https://go.dev/play/p/9Ex1-zcg-B-)] -- **Generate** : creates a stream where each element is generated by the provided generator function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Generate)] - [[play](https://go.dev/play/p/rkOWL1yA3j9)] -- **Concat** : creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Concat)] - [[play](https://go.dev/play/p/HM4OlYk_OUC)] -- **Distinct** : creates returns a stream that removes the duplicated items. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Distinct)] - [[play](https://go.dev/play/p/eGkOSrm64cB)] -- **Filter** : returns a stream consisting of the elements of this stream that match the given predicate. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Filter)] - [[play](https://go.dev/play/p/MFlSANo-buc)] -- **FilterConcurrent** : Applies the provided filter function `predicate` to each element of the input slice concurrently. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FilterConcurrent)] - [[play](https://go.dev/play/p/t_pkwerIRVx)] -- **Map** : returns a stream consisting of the elements of this stream that apply the given function to elements of stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Map)] - [[play](https://go.dev/play/p/OtNQUImdYko)] -- **Peek** : returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Peek)] - [[play](https://go.dev/play/p/u1VNzHs6cb2)] -- **Skip** : returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Skip)] - [[play](https://go.dev/play/p/fNdHbqjahum)] -- **Limit** : returns a stream consisting of the elements of this stream, truncated to be no longer than maxSize in length. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Limit)] - [[play](https://go.dev/play/p/qsO4aniDcGf)] -- **Reverse** : returns a stream whose elements are reverse order of given stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Reverse)] - [[play](https://go.dev/play/p/A8_zkJnLHm4)] -- **ReverseCopy** : returns a new slice of element order is reversed to the given slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ReverseCopy)] - [[play](https://go.dev/play/p/c9arEaP7Cg-)] -- **Range** : returns a stream whose elements are in the range from start(included) to end(excluded) original stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Range)] - [[play](https://go.dev/play/p/indZY5V2f4j)] -- **Sorted** : returns a stream consisting of the elements of this stream, sorted according to the provided less function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Sorted)] - [[play](https://go.dev/play/p/XXtng5uonFj)] -- **ForEach** : performs an action for each element of this stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ForEach)] - [[play](https://go.dev/play/p/Dsm0fPqcidk)] -- **Reduce** : performs a reduction on the elements of this stream, using an associative accumulation function, and returns an Optional describing the reduced value, if any. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Reduce)] - [[play](https://go.dev/play/p/6uzZjq_DJLU)] -- **FindFirst** : returns the first element of this stream and true, or zero value and false if the stream is empty. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FindFirst)] - [[play](https://go.dev/play/p/9xEf0-6C1e3)] -- **FindLast** : returns the last element of this stream and true, or zero value and false if the stream is empty. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FindLast)] - [[play](https://go.dev/play/p/WZD2rDAW-2h)] -- **Max** : returns the maximum element of this stream according to the provided less function. less function: a > b - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Max)] - [[play](https://go.dev/play/p/fm-1KOPtGzn)] -- **Min** : returns the minimum element of this stream according to the provided less function. less function: a < b - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Min)] - [[play](https://go.dev/play/p/vZfIDgGNRe_0)] -- **AllMatch** : returns whether all elements of this stream match the provided predicate. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#AllMatch)] - [[play](https://go.dev/play/p/V5TBpVRs-Cx)] -- **AnyMatch** : returns whether any elements of this stream match the provided predicate. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#AnyMatch)] - [[play](https://go.dev/play/p/PTCnWn4OxSn)] -- **NoneMatch** : returns whether no elements of this stream match the provided predicate. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#NoneMatch)] - [[play](https://go.dev/play/p/iWS64pL1oo3)] -- **Count** : returns the count of elements in the stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Count)] - [[play](https://go.dev/play/p/r3koY6y_Xo-)] -- **ToSlice** : returns the elements in the stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ToSlice)] - [[play](https://go.dev/play/p/jI6_iZZuVFE)] -- **IndexOf** : returns the index of the first occurrence of the specified element in this stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#IndexOf)] - [[play](https://go.dev/play/p/tBV5Nc-XDX2)] -- **LastIndexOf** : returns the index of the last occurrence of the specified element in this stream. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#LastIndexOf)] - [[play](https://go.dev/play/p/CjeoNw2eac_G)] +- **Of** : creates a stream whose elements are the specified values. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Of)] + [[play](https://go.dev/play/p/jI6_iZZuVFE)] +- **FromSlice** : creates a stream from slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromSlice)] + [[play](https://go.dev/play/p/wywTO0XZtI4)] +- **FromChannel** : creates a stream from channel. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromChannel)] + [[play](https://go.dev/play/p/9TZYugGMhXZ)] +- **FromRange** : creates a number stream from start to end. both start and end are included. [start, end] + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromRange)] + [[play](https://go.dev/play/p/9Ex1-zcg-B-)] +- **Generate** : creates a stream where each element is generated by the provided generator function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Generate)] + [[play](https://go.dev/play/p/rkOWL1yA3j9)] +- **Concat** : creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Concat)] + [[play](https://go.dev/play/p/HM4OlYk_OUC)] +- **Distinct** : creates returns a stream that removes the duplicated items. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Distinct)] + [[play](https://go.dev/play/p/eGkOSrm64cB)] +- **Filter** : returns a stream consisting of the elements of this stream that match the given predicate. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Filter)] + [[play](https://go.dev/play/p/MFlSANo-buc)] +- **FilterConcurrent** : Applies the provided filter function `predicate` to each element of the input slice concurrently. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FilterConcurrent)] + [[play](https://go.dev/play/p/t_pkwerIRVx)] +- **Map** : returns a stream consisting of the elements of this stream that apply the given function to elements of stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Map)] + [[play](https://go.dev/play/p/OtNQUImdYko)] +- **Peek** : returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Peek)] + [[play](https://go.dev/play/p/u1VNzHs6cb2)] +- **Skip** : returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Skip)] + [[play](https://go.dev/play/p/fNdHbqjahum)] +- **Limit** : returns a stream consisting of the elements of this stream, truncated to be no longer than maxSize in length. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Limit)] + [[play](https://go.dev/play/p/qsO4aniDcGf)] +- **Reverse** : returns a stream whose elements are reverse order of given stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Reverse)] + [[play](https://go.dev/play/p/A8_zkJnLHm4)] +- **ReverseCopy** : returns a new slice of element order is reversed to the given slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ReverseCopy)] + [[play](https://go.dev/play/p/c9arEaP7Cg-)] +- **Range** : returns a stream whose elements are in the range from start(included) to end(excluded) original stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Range)] + [[play](https://go.dev/play/p/indZY5V2f4j)] +- **Sorted** : returns a stream consisting of the elements of this stream, sorted according to the provided less function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Sorted)] + [[play](https://go.dev/play/p/XXtng5uonFj)] +- **ForEach** : performs an action for each element of this stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ForEach)] + [[play](https://go.dev/play/p/Dsm0fPqcidk)] +- **Reduce** : performs a reduction on the elements of this stream, using an associative accumulation function, and returns an Optional describing the reduced value, if any. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Reduce)] + [[play](https://go.dev/play/p/6uzZjq_DJLU)] +- **FindFirst** : returns the first element of this stream and true, or zero value and false if the stream is empty. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FindFirst)] + [[play](https://go.dev/play/p/9xEf0-6C1e3)] +- **FindLast** : returns the last element of this stream and true, or zero value and false if the stream is empty. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FindLast)] + [[play](https://go.dev/play/p/WZD2rDAW-2h)] +- **Max** : returns the maximum element of this stream according to the provided less function. less function: a > b + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Max)] + [[play](https://go.dev/play/p/fm-1KOPtGzn)] +- **Min** : returns the minimum element of this stream according to the provided less function. less function: a < b + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Min)] + [[play](https://go.dev/play/p/vZfIDgGNRe_0)] +- **AllMatch** : returns whether all elements of this stream match the provided predicate. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#AllMatch)] + [[play](https://go.dev/play/p/V5TBpVRs-Cx)] +- **AnyMatch** : returns whether any elements of this stream match the provided predicate. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#AnyMatch)] + [[play](https://go.dev/play/p/PTCnWn4OxSn)] +- **NoneMatch** : returns whether no elements of this stream match the provided predicate. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#NoneMatch)] + [[play](https://go.dev/play/p/iWS64pL1oo3)] +- **Count** : returns the count of elements in the stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Count)] + [[play](https://go.dev/play/p/r3koY6y_Xo-)] +- **ToSlice** : returns the elements in the stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ToSlice)] + [[play](https://go.dev/play/p/jI6_iZZuVFE)] +- **IndexOf** : returns the index of the first occurrence of the specified element in this stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#IndexOf)] + [[play](https://go.dev/play/p/tBV5Nc-XDX2)] +- **LastIndexOf** : returns the index of the last occurrence of the specified element in this stream. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#LastIndexOf)] + [[play](https://go.dev/play/p/CjeoNw2eac_G)]

22. Structs package provides several high level functions to manipulate struct, tag, and field.        index

@@ -1927,51 +1927,51 @@ import "github.com/duke-git/lancet/v2/structs" #### Function list: -- **New** : creates a `Struct` instance. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#New)] - [[play](https://go.dev/play/p/O29l8kk-Z17)] -- **ToMap** : converts a valid struct to a map. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#ToMap)] - [[play](https://go.dev/play/p/qQbLySBgerZ)] -- **Fields** : get all fields of a given struct, that the fields are abstract struct field. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Fields)] - [[play](https://go.dev/play/p/w3Kk_CyVY7D)] -- **Field** : get an abstract field of a struct by given field name - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Field)] - [[play](https://go.dev/play/p/KocZMSYarza)] -- **IsStruct** : check if the struct is valid. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsStruct)] - [[play](https://go.dev/play/p/bU2FSdkbK1C)] -- **Tag** : get a `Tag` of the `Field`, `Tag` is a abstract struct field tag. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Tag)] - [[play](https://go.dev/play/p/DVrx5HvvUJr)] -- **Name** : get the field name. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Name)] - [[play](https://go.dev/play/p/zfIGlqsatee)] -- **Value** : get the `Field` underlying value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Value)] - [[play](https://go.dev/play/p/qufYEU2o4Oi)] -- **Kind** : get the field's kind. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Kind)] - [[play](https://go.dev/play/p/wg4NlcUNG5o)] -- **IsEmbedded** : check if the field is an embedded field. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsEmbedded)] - [[play](https://go.dev/play/p/wV2PrbYm3Ec)] -- **IsExported** : check if the field is exported. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsExported)] - [[play](https://go.dev/play/p/csK4AXYaNbJ)] -- **IsZero** : check if the field is zero value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsZero)] - [[play](https://go.dev/play/p/RzqpGISf87r)] -- **IsSlice** : check if the field is a slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsSlice)] - [[play](https://go.dev/play/p/MKz4CgBIUrU)] -- **IsTargetType** : check if the field is target type. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsTargetType)] - [[play](https://go.dev/play/p/Ig75P-agN39)] -- **TypeName** : Return struct type name. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#TypeName)] - [[play](https://go.dev/play/p/SWLWd0XBaBb)] +- **New** : creates a `Struct` instance. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#New)] + [[play](https://go.dev/play/p/O29l8kk-Z17)] +- **ToMap** : converts a valid struct to a map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#ToMap)] + [[play](https://go.dev/play/p/qQbLySBgerZ)] +- **Fields** : get all fields of a given struct, that the fields are abstract struct field. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Fields)] + [[play](https://go.dev/play/p/w3Kk_CyVY7D)] +- **Field** : get an abstract field of a struct by given field name + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Field)] + [[play](https://go.dev/play/p/KocZMSYarza)] +- **IsStruct** : check if the struct is valid. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsStruct)] + [[play](https://go.dev/play/p/bU2FSdkbK1C)] +- **Tag** : get a `Tag` of the `Field`, `Tag` is a abstract struct field tag. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Tag)] + [[play](https://go.dev/play/p/DVrx5HvvUJr)] +- **Name** : get the field name. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Name)] + [[play](https://go.dev/play/p/zfIGlqsatee)] +- **Value** : get the `Field` underlying value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Value)] + [[play](https://go.dev/play/p/qufYEU2o4Oi)] +- **Kind** : get the field's kind. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Kind)] + [[play](https://go.dev/play/p/wg4NlcUNG5o)] +- **IsEmbedded** : check if the field is an embedded field. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsEmbedded)] + [[play](https://go.dev/play/p/wV2PrbYm3Ec)] +- **IsExported** : check if the field is exported. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsExported)] + [[play](https://go.dev/play/p/csK4AXYaNbJ)] +- **IsZero** : check if the field is zero value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsZero)] + [[play](https://go.dev/play/p/RzqpGISf87r)] +- **IsSlice** : check if the field is a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsSlice)] + [[play](https://go.dev/play/p/MKz4CgBIUrU)] +- **IsTargetType** : check if the field is target type. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsTargetType)] + [[play](https://go.dev/play/p/Ig75P-agN39)] +- **TypeName** : Return struct type name. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#TypeName)] + [[play](https://go.dev/play/p/SWLWd0XBaBb)]

23. Strutil package contains some functions to manipulate string.        index

@@ -1981,152 +1981,152 @@ import "github.com/duke-git/lancet/v2/strutil" #### Function list: -- **After** : returns the substring after the first occurrence of a specific string in the source string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#After)] - [[play](https://go.dev/play/p/RbCOQqCDA7m)] -- **AfterLast** : returns the substring after the last occurrence of a specific string in the source string. [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#AfterLast)] - [[play](https://go.dev/play/p/1TegARrb8Yn)] -- **Before** : returns the substring before the first occurrence of a specific string in the source string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Before)] - [[play](https://go.dev/play/p/JAWTZDS4F5w)] -- **BeforeLast** : returns the substring before the last occurrence of a specific string in the source string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#BeforeLast)] - [[play](https://go.dev/play/p/pJfXXAoG_Te)] -- **CamelCase** : coverts source string to its camelCase string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#CamelCase)] - [[play](https://go.dev/play/p/9eXP3tn2tUy)] -- **UpperCamelCase** : coverts source string to its UpperCamelCase string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperCamelCase)] - [[play](https://go.dev/play/p/vPHszjTXSFp)] -- **Capitalize** : converts the first character of source string to upper case and the remaining to lower case. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Capitalize)] - [[play](https://go.dev/play/p/2OAjgbmAqHZ)] -- **ContainsAll** : return true if target string contains all the substrings. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ContainsAll)] - [[play](https://go.dev/play/p/KECtK2Os4zq)] -- **ContainsAny** : return true if target string contains any one of the substrings. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ContainsAny)] - [[play](https://go.dev/play/p/dZGSSMB3LXE)] -- **IsString** : checks if the parameter value data type is string or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsString)] - [[play](https://go.dev/play/p/IOgq7oF9ERm)] -- **KebabCase** : coverts string to kebab-case string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#KebabCase)] - [[play](https://go.dev/play/p/dcZM9Oahw-Y)] -- **UpperKebabCase** : coverts string to upper KEBAB-CASE string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperKebabCase)] - [[play](https://go.dev/play/p/zDyKNneyQXk)] -- **LowerFirst** : converts the first character of string to lower case. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#LowerFirst)] - [[play](https://go.dev/play/p/CbzAyZmtJwL)] -- **UpperFirst** : converts the first character of string to upper case. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperFirst)] - [[play](https://go.dev/play/p/sBbBxRbs8MM)] -- **Pad** : pads string on the left and right side if it's shorter than size. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Pad)] - [[play](https://go.dev/play/p/NzImQq-VF8q)] -- **PadEnd** : pads string with given characters on the right side if it's shorter than limit size. Padding characters are truncated if they exceed size. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#PadEnd)] - [[play](https://go.dev/play/p/9xP8rN0vz--)] -- **PadStart** : pads string with given characters on the left side if it's shorter than limit size. Padding characters are truncated if they exceed size. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#PadStart)] - [[play](https://go.dev/play/p/xpTfzArDfvT)] -- **Reverse** : returns string whose char order is reversed to the given string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Reverse)] - [[play](https://go.dev/play/p/adfwalJiecD)] -- **SnakeCase** : coverts string to snake_case string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SnakeCase)] - [[play](https://go.dev/play/p/tgzQG11qBuN)] -- **UpperSnakeCase** : coverts string to upper SNAKE_CASE string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperSnakeCase)] - [[play](https://go.dev/play/p/4COPHpnLx38)] -- **SplitEx** : split a given string which can control the result slice contains empty string or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitEx)] - [[play](https://go.dev/play/p/Us-ySSbWh-3)] -- **Substring** : returns a substring of the specific length starting at the specific offset position. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Substring)] - [[play](https://go.dev/play/p/q3sM6ehnPDp)] -- **Wrap** : wrap a string with given string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Wrap)] - [[play](https://go.dev/play/p/KoZOlZDDt9y)] -- **Unwrap** : unwrap a given string from anther string. will change source string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Unwrap)] - [[play](https://go.dev/play/p/Ec2q4BzCpG-)] -- **SplitWords** : splits a string into words, word only contains alphabetic characters. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitWords)] - [[play](https://go.dev/play/p/KLiX4WiysMM)] -- **WordCount** : return the number of meaningful word of a string, word only contains alphabetic characters. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#WordCount)] - [[play](https://go.dev/play/p/bj7_odx3vRf)] -- **RemoveNonPrintable** : remove non-printable characters from a string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RemoveNonPrintable)] - [[play](https://go.dev/play/p/og47F5x_jTZ)] -- **StringToBytes** : converts a string to byte slice without a memory allocation. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#StringToBytes)] - [[play](https://go.dev/play/p/7OyFBrf9AxA)] -- **BytesToString** : converts a byte slice to string without a memory allocation. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#BytesToString)] - [[play](https://go.dev/play/p/6c68HRvJecH)] -- **IsBlank** : checks if a string is whitespace or empty. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsBlank)] - [[play](https://go.dev/play/p/6zXRH_c0Qd3)] -- **IsNotBlank** : checks if a string is not whitespace or not empty. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsNotBlank)] - [[play](https://go.dev/play/p/e_oJW0RAquA)] -- **HasPrefixAny** : checks if a string starts with any of an array of specified strings. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HasPrefixAny)] - [[play](https://go.dev/play/p/8UUTl2C5slo)] -- **HasSuffixAny** : checks if a string ends with any of an array of specified strings. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HasSuffixAny)] - [[play](https://go.dev/play/p/sKWpCQdOVkx)] -- **IndexOffset** : returns the index of the first instance of substr in string after offsetting the string by `idxFrom`. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IndexOffset)] - [[play](https://go.dev/play/p/qZo4lV2fomB)] -- **ReplaceWithMap** : returns a copy of `str`, which is replaced by a map in unordered way, case-sensitively. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ReplaceWithMap)] - [[play](https://go.dev/play/p/h3t7CNj2Vvu)] -- **Trim** : strips whitespace (or other characters) from the beginning and end of a string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Trim)] - [[play](https://go.dev/play/p/Y0ilP0NRV3j)] -- **SplitAndTrim** : splits string `str` by a string `delimiter` to a slice, and calls Trim to every element of slice. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitAndTrim)] - [[play](https://go.dev/play/p/ZNL6o4SkYQ7)] -- **HideString** : Hide some chars in source string with param `replaceChar`. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HideString)] - [[play](https://go.dev/play/p/pzbaIVCTreZ)] -- **RemoveWhiteSpace** : remove whitespace characters from a string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RemoveWhiteSpace)] - [[play](https://go.dev/play/p/HzLC9vsTwkf)] -- **SubInBetween** : return substring between the start and end position(excluded) of source string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SubInBetween)] - [[play](https://go.dev/play/p/EDbaRvjeNsv)] -- **HammingDistance** : calculates the Hamming distance between two strings. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HammingDistance)] - [[play](https://go.dev/play/p/glNdQEA9HUi)] -- **Concat** : concatenates strings. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Concat)] - [[play](https://go.dev/play/p/gD52SZHr4Kp)] -- **Ellipsis** : truncates a string to a specified length and appends an ellipsis. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Ellipsis)] - [[play](https://go.dev/play/p/i1vbdQiQVRR)] -- **Shuffle** : shuffle the order of characters of given string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Shuffle)] - [[play](https://go.dev/play/p/iStFwBwyGY7)] -- **Rotate** : rotates the string by the specified number of characters. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Rotate)] - [[play](https://go.dev/play/p/Kf03iOeT5bd)] -- **TemplateReplace** : replaces the placeholders in the template string with the corresponding values in the data map. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#TemplateReplace)] - [[play](https://go.dev/play/p/cXSuFvyZqv9)] -- **RegexMatchAllGroups** : matches all subgroups in a string using a regular expression and returns the result. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RegexMatchAllGroups)] - [[play](https://go.dev/play/p/JZiu0RXpgN-)] -- **ExtractContent** : extracts the content between the start and end strings in the source string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ExtractContent)] - [[play](https://go.dev/play/p/Ay9UIk7Rum9)] -- **FindAllOccurrences** : Returns the positions of all occurrences of a substring in a string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#FindAllOccurrences)] - [[play](https://go.dev/play/p/uvyA6azGLB1)] +- **After** : returns the substring after the first occurrence of a specific string in the source string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#After)] + [[play](https://go.dev/play/p/RbCOQqCDA7m)] +- **AfterLast** : returns the substring after the last occurrence of a specific string in the source string. [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#AfterLast)] + [[play](https://go.dev/play/p/1TegARrb8Yn)] +- **Before** : returns the substring before the first occurrence of a specific string in the source string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Before)] + [[play](https://go.dev/play/p/JAWTZDS4F5w)] +- **BeforeLast** : returns the substring before the last occurrence of a specific string in the source string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#BeforeLast)] + [[play](https://go.dev/play/p/pJfXXAoG_Te)] +- **CamelCase** : coverts source string to its camelCase string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#CamelCase)] + [[play](https://go.dev/play/p/9eXP3tn2tUy)] +- **UpperCamelCase** : coverts source string to its UpperCamelCase string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperCamelCase)] + [[play](https://go.dev/play/p/vPHszjTXSFp)] +- **Capitalize** : converts the first character of source string to upper case and the remaining to lower case. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Capitalize)] + [[play](https://go.dev/play/p/2OAjgbmAqHZ)] +- **ContainsAll** : return true if target string contains all the substrings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ContainsAll)] + [[play](https://go.dev/play/p/KECtK2Os4zq)] +- **ContainsAny** : return true if target string contains any one of the substrings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ContainsAny)] + [[play](https://go.dev/play/p/dZGSSMB3LXE)] +- **IsString** : checks if the parameter value data type is string or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsString)] + [[play](https://go.dev/play/p/IOgq7oF9ERm)] +- **KebabCase** : coverts string to kebab-case string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#KebabCase)] + [[play](https://go.dev/play/p/dcZM9Oahw-Y)] +- **UpperKebabCase** : coverts string to upper KEBAB-CASE string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperKebabCase)] + [[play](https://go.dev/play/p/zDyKNneyQXk)] +- **LowerFirst** : converts the first character of string to lower case. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#LowerFirst)] + [[play](https://go.dev/play/p/CbzAyZmtJwL)] +- **UpperFirst** : converts the first character of string to upper case. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperFirst)] + [[play](https://go.dev/play/p/sBbBxRbs8MM)] +- **Pad** : pads string on the left and right side if it's shorter than size. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Pad)] + [[play](https://go.dev/play/p/NzImQq-VF8q)] +- **PadEnd** : pads string with given characters on the right side if it's shorter than limit size. Padding characters are truncated if they exceed size. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#PadEnd)] + [[play](https://go.dev/play/p/9xP8rN0vz--)] +- **PadStart** : pads string with given characters on the left side if it's shorter than limit size. Padding characters are truncated if they exceed size. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#PadStart)] + [[play](https://go.dev/play/p/xpTfzArDfvT)] +- **Reverse** : returns string whose char order is reversed to the given string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Reverse)] + [[play](https://go.dev/play/p/adfwalJiecD)] +- **SnakeCase** : coverts string to snake_case string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SnakeCase)] + [[play](https://go.dev/play/p/tgzQG11qBuN)] +- **UpperSnakeCase** : coverts string to upper SNAKE_CASE string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperSnakeCase)] + [[play](https://go.dev/play/p/4COPHpnLx38)] +- **SplitEx** : split a given string which can control the result slice contains empty string or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitEx)] + [[play](https://go.dev/play/p/Us-ySSbWh-3)] +- **Substring** : returns a substring of the specific length starting at the specific offset position. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Substring)] + [[play](https://go.dev/play/p/q3sM6ehnPDp)] +- **Wrap** : wrap a string with given string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Wrap)] + [[play](https://go.dev/play/p/KoZOlZDDt9y)] +- **Unwrap** : unwrap a given string from anther string. will change source string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Unwrap)] + [[play](https://go.dev/play/p/Ec2q4BzCpG-)] +- **SplitWords** : splits a string into words, word only contains alphabetic characters. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitWords)] + [[play](https://go.dev/play/p/KLiX4WiysMM)] +- **WordCount** : return the number of meaningful word of a string, word only contains alphabetic characters. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#WordCount)] + [[play](https://go.dev/play/p/bj7_odx3vRf)] +- **RemoveNonPrintable** : remove non-printable characters from a string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RemoveNonPrintable)] + [[play](https://go.dev/play/p/og47F5x_jTZ)] +- **StringToBytes** : converts a string to byte slice without a memory allocation. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#StringToBytes)] + [[play](https://go.dev/play/p/7OyFBrf9AxA)] +- **BytesToString** : converts a byte slice to string without a memory allocation. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#BytesToString)] + [[play](https://go.dev/play/p/6c68HRvJecH)] +- **IsBlank** : checks if a string is whitespace or empty. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsBlank)] + [[play](https://go.dev/play/p/6zXRH_c0Qd3)] +- **IsNotBlank** : checks if a string is not whitespace or not empty. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsNotBlank)] + [[play](https://go.dev/play/p/e_oJW0RAquA)] +- **HasPrefixAny** : checks if a string starts with any of an array of specified strings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HasPrefixAny)] + [[play](https://go.dev/play/p/8UUTl2C5slo)] +- **HasSuffixAny** : checks if a string ends with any of an array of specified strings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HasSuffixAny)] + [[play](https://go.dev/play/p/sKWpCQdOVkx)] +- **IndexOffset** : returns the index of the first instance of substr in string after offsetting the string by `idxFrom`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IndexOffset)] + [[play](https://go.dev/play/p/qZo4lV2fomB)] +- **ReplaceWithMap** : returns a copy of `str`, which is replaced by a map in unordered way, case-sensitively. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ReplaceWithMap)] + [[play](https://go.dev/play/p/h3t7CNj2Vvu)] +- **Trim** : strips whitespace (or other characters) from the beginning and end of a string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Trim)] + [[play](https://go.dev/play/p/Y0ilP0NRV3j)] +- **SplitAndTrim** : splits string `str` by a string `delimiter` to a slice, and calls Trim to every element of slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitAndTrim)] + [[play](https://go.dev/play/p/ZNL6o4SkYQ7)] +- **HideString** : Hide some chars in source string with param `replaceChar`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HideString)] + [[play](https://go.dev/play/p/pzbaIVCTreZ)] +- **RemoveWhiteSpace** : remove whitespace characters from a string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RemoveWhiteSpace)] + [[play](https://go.dev/play/p/HzLC9vsTwkf)] +- **SubInBetween** : return substring between the start and end position(excluded) of source string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SubInBetween)] + [[play](https://go.dev/play/p/EDbaRvjeNsv)] +- **HammingDistance** : calculates the Hamming distance between two strings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HammingDistance)] + [[play](https://go.dev/play/p/glNdQEA9HUi)] +- **Concat** : concatenates strings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Concat)] + [[play](https://go.dev/play/p/gD52SZHr4Kp)] +- **Ellipsis** : truncates a string to a specified length and appends an ellipsis. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Ellipsis)] + [[play](https://go.dev/play/p/i1vbdQiQVRR)] +- **Shuffle** : shuffle the order of characters of given string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Shuffle)] + [[play](https://go.dev/play/p/iStFwBwyGY7)] +- **Rotate** : rotates the string by the specified number of characters. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Rotate)] + [[play](https://go.dev/play/p/Kf03iOeT5bd)] +- **TemplateReplace** : replaces the placeholders in the template string with the corresponding values in the data map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#TemplateReplace)] + [[play](https://go.dev/play/p/cXSuFvyZqv9)] +- **RegexMatchAllGroups** : matches all subgroups in a string using a regular expression and returns the result. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RegexMatchAllGroups)] + [[play](https://go.dev/play/p/JZiu0RXpgN-)] +- **ExtractContent** : extracts the content between the start and end strings in the source string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ExtractContent)] + [[play](https://go.dev/play/p/Ay9UIk7Rum9)] +- **FindAllOccurrences** : Returns the positions of all occurrences of a substring in a string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#FindAllOccurrences)] + [[play](https://go.dev/play/p/uvyA6azGLB1)]

24. System package contain some functions about os, runtime, shell command.        index

@@ -2136,45 +2136,45 @@ import "github.com/duke-git/lancet/v2/system" #### Function list: -- **IsWindows** : check if current os is windows. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsWindows)] - [[play](https://go.dev/play/p/XzJULbzmf9m)] -- **IsLinux** : check if current os is linux. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsLinux)] - [[play](https://go.dev/play/p/zIflQgZNuxD)] -- **IsMac** : check if current os is macos. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsMac)] - [[play](https://go.dev/play/p/Mg4Hjtyq7Zc)] -- **GetOsEnv** : get the value of the environment variable named by the key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetOsEnv)] - [[play](https://go.dev/play/p/D88OYVCyjO-)] -- **SetOsEnv** : set the value of the environment variable named by the key. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#SetOsEnv)] - [[play](https://go.dev/play/p/D88OYVCyjO-)] -- **RemoveOsEnv** : remove a single environment variable. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#RemoveOsEnv)] - [[play](https://go.dev/play/p/fqyq4b3xUFQ)] -- **CompareOsEnv** : get env named by the key and compare it with passed env. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#CompareOsEnv)] - [[play](https://go.dev/play/p/BciHrKYOHbp)] -- **ExecCommand** : execute command, return the stdout and stderr string of command, and error if error occurs. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#ExecCommand)] - [[play](https://go.dev/play/p/n-2fLyZef-4)] -- **GetOsBits** : return current os bits (32 or 64). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetOsBits)] - [[play](https://go.dev/play/p/ml-_XH3gJbW)] -- **StartProcess** : start a new process with the specified name and arguments. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#StartProcess)] - [[play](https://go.dev/play/p/5GVol6ryS_X)] -- **StopProcess** : stop a process by pid. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#StopProcess)] - [[play](https://go.dev/play/p/jJZhRYGGcmD)] -- **KillProcess** : kill a new process with the specified name and arguments. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#KillProcess)] - [[play](https://go.dev/play/p/XKmvV-ExBWa)] -- **GetProcessInfo** : retrieves detailed process information by pid. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetProcessInfo)] - [[play](https://go.dev/play/p/NQDVywEYYx7)] +- **IsWindows** : check if current os is windows. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsWindows)] + [[play](https://go.dev/play/p/XzJULbzmf9m)] +- **IsLinux** : check if current os is linux. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsLinux)] + [[play](https://go.dev/play/p/zIflQgZNuxD)] +- **IsMac** : check if current os is macos. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsMac)] + [[play](https://go.dev/play/p/Mg4Hjtyq7Zc)] +- **GetOsEnv** : get the value of the environment variable named by the key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetOsEnv)] + [[play](https://go.dev/play/p/D88OYVCyjO-)] +- **SetOsEnv** : set the value of the environment variable named by the key. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#SetOsEnv)] + [[play](https://go.dev/play/p/D88OYVCyjO-)] +- **RemoveOsEnv** : remove a single environment variable. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#RemoveOsEnv)] + [[play](https://go.dev/play/p/fqyq4b3xUFQ)] +- **CompareOsEnv** : get env named by the key and compare it with passed env. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#CompareOsEnv)] + [[play](https://go.dev/play/p/BciHrKYOHbp)] +- **ExecCommand** : execute command, return the stdout and stderr string of command, and error if error occurs. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#ExecCommand)] + [[play](https://go.dev/play/p/n-2fLyZef-4)] +- **GetOsBits** : return current os bits (32 or 64). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetOsBits)] + [[play](https://go.dev/play/p/ml-_XH3gJbW)] +- **StartProcess** : start a new process with the specified name and arguments. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#StartProcess)] + [[play](https://go.dev/play/p/5GVol6ryS_X)] +- **StopProcess** : stop a process by pid. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#StopProcess)] + [[play](https://go.dev/play/p/jJZhRYGGcmD)] +- **KillProcess** : kill a new process with the specified name and arguments. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#KillProcess)] + [[play](https://go.dev/play/p/XKmvV-ExBWa)] +- **GetProcessInfo** : retrieves detailed process information by pid. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetProcessInfo)] + [[play](https://go.dev/play/p/NQDVywEYYx7)]

25. Tuple package implements tuple data type and some operations on it.        index

@@ -2184,114 +2184,114 @@ import "github.com/duke-git/lancet/v2/tuple" #### Function list: -- **Tuple2** : represents a 2 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple2)] - [[play](https://go.dev/play/p/3sHVqBQpLYN)] -- **Tuple2_Unbox** : returns values in Tuple2. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple2_Unbox)] - [[play](https://go.dev/play/p/0fD1qfCVwjm)] -- **Zip2** : create a slice of Tuple2, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip2)] - [[play](https://go.dev/play/p/4ncWJJ77Xio)] -- **Unzip2** : create a group of slice from a slice of Tuple2. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip2)] - [[play](https://go.dev/play/p/KBecr60feXb)] -- **Tuple3** : represents a 3 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple3)] - [[play](https://go.dev/play/p/FtH2sdCLlCf)] -- **Tuple3_Unbox** : returns values in Tuple3. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple3_Unbox)] - [[play](https://go.dev/play/p/YojLy-id1BS)] -- **Zip3** : create a slice of Tuple3, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip3)] - [[play](https://go.dev/play/p/97NgmsTILfu)] -- **Unzip3** : create a group of slice from a slice of Tuple3. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip3)] - [[play](https://go.dev/play/p/bba4cpAa7KO)] -- **Tuple4** : represents a 4 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple4)] - [[play](https://go.dev/play/p/D2EqDz096tk)] -- **Tuple4_Unbox** : returns values in Tuple4. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple4_Unbox)] - [[play](https://go.dev/play/p/ACj9YuACGgW)] -- **Zip4** : create a slice of Tuple4, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip4)] - [[play](https://go.dev/play/p/PEmTYVK5hL4)] -- **Unzip4** : create a group of slice from a slice of Tuple4. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip4)] - [[play](https://go.dev/play/p/rb8z4gyYSRN)] -- **Tuple5** : represents a 5 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple5)] - [[play](https://go.dev/play/p/2WndmVxPg-r)] -- **Tuple5_Unbox** : returns values in Tuple4. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple5_Unbox)] - [[play](https://go.dev/play/p/GyIyZHjCvoS)] -- **Zip5** : create a slice of Tuple5, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip5)] - [[play](https://go.dev/play/p/fCAAJLMfBIP)] -- **Unzip5** : create a group of slice from a slice of Tuple5. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip5)] - [[play](https://go.dev/play/p/gyl6vKfhqPb)] -- **Tuple6** : represents a 6 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple6)] - [[play](https://go.dev/play/p/VjqcCwEJZbs)] -- **Tuple6_Unbox** : returns values in Tuple6. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple6_Unbox)] - [[play](https://go.dev/play/p/FjIHV7lpxmW)] -- **Zip6** : create a slice of Tuple6, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip6)] - [[play](https://go.dev/play/p/oWPrnUYuFHo)] -- **Unzip6** : create a group of slice from a slice of Tuple6. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip6)] - [[play](https://go.dev/play/p/l41XFqCyh5E)] -- **Tuple7** : represents a 7 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple7)] - [[play](https://go.dev/play/p/dzAgv_Ezub9)] -- **Tuple7_Unbox** : returns values in Tuple7. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple7_Unbox)] - [[play](https://go.dev/play/p/R9I8qeDk0zs)] -- **Zip7** : create a slice of Tuple7, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip7)] - [[play](https://go.dev/play/p/WUJuo897Egf)] -- **Unzip7** : create a group of slice from a slice of Tuple7. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip7)] - [[play](https://go.dev/play/p/hws_P1Fr2j3)] -- **Tuple8** : represents a 8 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple8)] - [[play](https://go.dev/play/p/YA9S0rz3dRz)] -- **Tuple8_Unbox** : returns values in Tuple8. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple8_Unbox)] - [[play](https://go.dev/play/p/PRxLBBb4SMl)] -- **Zip8** : create a slice of Tuple8, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip8)] - [[play](https://go.dev/play/p/8V9jWkuJfaQ)] -- **Unzip8** : create a group of slice from a slice of Tuple8. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip8)] - [[play](https://go.dev/play/p/1SndOwGsZB4)] -- **Tuple9** : represents a 9 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple9)] - [[play](https://go.dev/play/p/yS2NGGtZpQr)] -- **Tuple9_Unbox** : returns values in Tuple9. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple9_Unbox)] - [[play](https://go.dev/play/p/oFJFGTAuOa8)] -- **Zip9** : create a slice of Tuple9, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip9)] - [[play](https://go.dev/play/p/cgsL15QYnfz)] -- **Unzip9** : create a group of slice from a slice of Tuple9. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip9)] - [[play](https://go.dev/play/p/91-BU_KURSA)] -- **Tuple10** : represents a 10 elements tuple. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple10)] - [[play](https://go.dev/play/p/799qqZg0hUv)] -- **Tuple10_Unbox** : returns values in Tuple10. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple10_Unbox)] - [[play](https://go.dev/play/p/qfyx3x_X0Cu)] -- **Zip10** : create a slice of Tuple10, whose elements are correspond to the given slice elements. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip10)] - [[play](https://go.dev/play/p/YSR-2cXnrY4)] -- **Unzip10** : create a group of slice from a slice of Tuple10. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip10)] - [[play](https://go.dev/play/p/-taQB6Wfre_z)] +- **Tuple2** : represents a 2 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple2)] + [[play](https://go.dev/play/p/3sHVqBQpLYN)] +- **Tuple2_Unbox** : returns values in Tuple2. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple2_Unbox)] + [[play](https://go.dev/play/p/0fD1qfCVwjm)] +- **Zip2** : create a slice of Tuple2, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip2)] + [[play](https://go.dev/play/p/4ncWJJ77Xio)] +- **Unzip2** : create a group of slice from a slice of Tuple2. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip2)] + [[play](https://go.dev/play/p/KBecr60feXb)] +- **Tuple3** : represents a 3 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple3)] + [[play](https://go.dev/play/p/FtH2sdCLlCf)] +- **Tuple3_Unbox** : returns values in Tuple3. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple3_Unbox)] + [[play](https://go.dev/play/p/YojLy-id1BS)] +- **Zip3** : create a slice of Tuple3, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip3)] + [[play](https://go.dev/play/p/97NgmsTILfu)] +- **Unzip3** : create a group of slice from a slice of Tuple3. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip3)] + [[play](https://go.dev/play/p/bba4cpAa7KO)] +- **Tuple4** : represents a 4 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple4)] + [[play](https://go.dev/play/p/D2EqDz096tk)] +- **Tuple4_Unbox** : returns values in Tuple4. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple4_Unbox)] + [[play](https://go.dev/play/p/ACj9YuACGgW)] +- **Zip4** : create a slice of Tuple4, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip4)] + [[play](https://go.dev/play/p/PEmTYVK5hL4)] +- **Unzip4** : create a group of slice from a slice of Tuple4. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip4)] + [[play](https://go.dev/play/p/rb8z4gyYSRN)] +- **Tuple5** : represents a 5 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple5)] + [[play](https://go.dev/play/p/2WndmVxPg-r)] +- **Tuple5_Unbox** : returns values in Tuple4. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple5_Unbox)] + [[play](https://go.dev/play/p/GyIyZHjCvoS)] +- **Zip5** : create a slice of Tuple5, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip5)] + [[play](https://go.dev/play/p/fCAAJLMfBIP)] +- **Unzip5** : create a group of slice from a slice of Tuple5. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip5)] + [[play](https://go.dev/play/p/gyl6vKfhqPb)] +- **Tuple6** : represents a 6 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple6)] + [[play](https://go.dev/play/p/VjqcCwEJZbs)] +- **Tuple6_Unbox** : returns values in Tuple6. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple6_Unbox)] + [[play](https://go.dev/play/p/FjIHV7lpxmW)] +- **Zip6** : create a slice of Tuple6, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip6)] + [[play](https://go.dev/play/p/oWPrnUYuFHo)] +- **Unzip6** : create a group of slice from a slice of Tuple6. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip6)] + [[play](https://go.dev/play/p/l41XFqCyh5E)] +- **Tuple7** : represents a 7 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple7)] + [[play](https://go.dev/play/p/dzAgv_Ezub9)] +- **Tuple7_Unbox** : returns values in Tuple7. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple7_Unbox)] + [[play](https://go.dev/play/p/R9I8qeDk0zs)] +- **Zip7** : create a slice of Tuple7, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip7)] + [[play](https://go.dev/play/p/WUJuo897Egf)] +- **Unzip7** : create a group of slice from a slice of Tuple7. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip7)] + [[play](https://go.dev/play/p/hws_P1Fr2j3)] +- **Tuple8** : represents a 8 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple8)] + [[play](https://go.dev/play/p/YA9S0rz3dRz)] +- **Tuple8_Unbox** : returns values in Tuple8. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple8_Unbox)] + [[play](https://go.dev/play/p/PRxLBBb4SMl)] +- **Zip8** : create a slice of Tuple8, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip8)] + [[play](https://go.dev/play/p/8V9jWkuJfaQ)] +- **Unzip8** : create a group of slice from a slice of Tuple8. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip8)] + [[play](https://go.dev/play/p/1SndOwGsZB4)] +- **Tuple9** : represents a 9 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple9)] + [[play](https://go.dev/play/p/yS2NGGtZpQr)] +- **Tuple9_Unbox** : returns values in Tuple9. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple9_Unbox)] + [[play](https://go.dev/play/p/oFJFGTAuOa8)] +- **Zip9** : create a slice of Tuple9, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip9)] + [[play](https://go.dev/play/p/cgsL15QYnfz)] +- **Unzip9** : create a group of slice from a slice of Tuple9. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip9)] + [[play](https://go.dev/play/p/91-BU_KURSA)] +- **Tuple10** : represents a 10 elements tuple. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple10)] + [[play](https://go.dev/play/p/799qqZg0hUv)] +- **Tuple10_Unbox** : returns values in Tuple10. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple10_Unbox)] + [[play](https://go.dev/play/p/qfyx3x_X0Cu)] +- **Zip10** : create a slice of Tuple10, whose elements are correspond to the given slice elements. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip10)] + [[play](https://go.dev/play/p/YSR-2cXnrY4)] +- **Unzip10** : create a group of slice from a slice of Tuple10. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip10)] + [[play](https://go.dev/play/p/-taQB6Wfre_z)]

26. Validator package contains some functions for data validation.        index

@@ -2301,144 +2301,144 @@ import "github.com/duke-git/lancet/v2/validator" #### Function list: -- **ContainChinese** : check if the string contain mandarin chinese. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainChinese)] - [[play](https://go.dev/play/p/7DpU0uElYeM)] -- **ContainLetter** : check if the string contain at least one letter. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainLetter)] - [[play](https://go.dev/play/p/lqFD04Yyewp)] -- **ContainLower** : check if the string contain at least one lower case letter a-z. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainLower)] - [[play](https://go.dev/play/p/Srqi1ItvnAA)] -- **ContainUpper** : check if the string contain at least one upper case letter A-Z. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainUpper)] - [[play](https://go.dev/play/p/CmWeBEk27-z)] -- **IsAlpha** : checks if the string contains only letters (a-zA-Z). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAlpha)] - [[play](https://go.dev/play/p/7Q5sGOz2izQ)] -- **IsAllUpper** : check if the string is all upper case letters A-Z. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAllUpper)] - [[play](https://go.dev/play/p/ZHctgeK1n4Z)] -- **IsAllLower** : check if the string is all lower case letters a-z. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAllLower)] - [[play](https://go.dev/play/p/GjqCnOfV6cM)] -- **IsBase64** : check if the string is base64 string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBase64)] - [[play](https://go.dev/play/p/sWHEySAt6hl)] -- **IsChineseMobile** : check if the string is chinese mobile number. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseMobile)] - [[play](https://go.dev/play/p/GPYUlGTOqe3)] -- **IsChineseIdNum** : check if the string is chinese id card. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseIdNum)] - [[play](https://go.dev/play/p/d8EWhl2UGDF)] -- **IsChinesePhone** : check if the string is chinese phone number.(xxx-xxxxxxxx or xxxx-xxxxxxx.) - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChinesePhone)] - [[play](https://go.dev/play/p/RUD_-7YZJ3I)] -- **IsCreditCard** : check if the string is credit card. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsCreditCard)] - [[play](https://go.dev/play/p/sNwwL6B0-v4)] -- **IsDns** : check if the string is dns. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsDns)] - [[play](https://go.dev/play/p/jlYApVLLGTZ)] -- **IsEmail** : check if the string is a email address. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsEmail)] - [[play](https://go.dev/play/p/HVQ5LAe-vFz)] -- **IsEmptyString** : check if the string is empty. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsEmptyString)] - [[play](https://go.dev/play/p/dpzgUjFnBCX)] -- **IsFloat** : check if the value is float(float32, float34) or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsFloat)] - [[play](https://go.dev/play/p/vsyG-sxr99_Z)] -- **IsFloatStr** : check if the string can convert to a float. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsFloatStr)] - [[play](https://go.dev/play/p/LOYwS_Oyl7U)] -- **IsNumber** : check if the value is number(integer, float) or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsNumber)] - [[play](https://go.dev/play/p/mdJHOAvtsvF)] -- **IsNumberStr** : check if the string can convert to a number. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsNumberStr)] - [[play](https://go.dev/play/p/LzaKocSV79u)] -- **IsAlphaNumeric** : check if the string is alphanumeric. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAlphaNumeric)] - [[play](https://go.dev/play/p/RHeESLrLg9c)] -- **IsJSON** : check if the string is valid JSON. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsJSON)] - [[play](https://go.dev/play/p/8Kip1Itjiil)] -- **IsRegexMatch** : check if the string match the regexp. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsRegexMatch)] - [[play](https://go.dev/play/p/z_XeZo_litG)] -- **IsInt** : check if the string can convert to a number. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsInt)] - [[play](https://go.dev/play/p/eFoIHbgzl-z)] -- **IsIntStr** : check if the string can convert to a integer. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIntStr)] - [[play](https://go.dev/play/p/jQRtFv-a0Rk)] -- **IsIp** : check if the string is ip. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIp)] - [[play](https://go.dev/play/p/FgcplDvmxoD)] -- **IsIpV4** : check if the string is ipv4. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpV4)] - [[play](https://go.dev/play/p/zBGT99EjaIu)] -- **IsIpV6** : check if the string is ipv6. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpV6)] - [[play](https://go.dev/play/p/AHA0r0AzIdC)] -- **IsIpPort** : check if the string is ip:port. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpPort)] - [[play](https://go.dev/play/p/xUmls_b9L29)] -- **IsStrongPassword** : check if the string is strong password. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsStrongPassword)] - [[play](https://go.dev/play/p/QHdVcSQ3uDg)] -- **IsUrl** : check if the string is url. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsUrl)] - [[play](https://go.dev/play/p/pbJGa7F98Ka)] -- **IsWeakPassword** : check if the string is weak password. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsWeakPassword)] - [[play](https://go.dev/play/p/wqakscZH5gH)] -- **IsZeroValue** : check if value is a zero value. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsZeroValue)] - [[play](https://go.dev/play/p/UMrwaDCi_t4)] -- **IsGBK** : check if data encoding is gbk. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsGBK)] - [[play](https://go.dev/play/p/E2nt3unlmzP)] -- **IsASCII** : checks if string is all ASCII char. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsASCII)] - [[play](https://go.dev/play/p/hfQNPLX0jNa)] -- **IsPrintable** : checks if string is all printable chars. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsPrintable)] - [[play](https://go.dev/play/p/Pe1FE2gdtTP)] -- **IsBin** : check if a give string is a valid binary value or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBin)] - [[play](https://go.dev/play/p/ogPeg2XJH4P)] -- **IsHex** : check if a give string is a valid hexadecimal value or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsHex)] - [[play](https://go.dev/play/p/M2qpHbEwmm7)] -- **IsBase64URL** : check if a give string is a valid URL-safe Base64 encoded string. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBase64URL)] - [[play](https://go.dev/play/p/vhl4mr8GZ6S)] -- **IsJWT** : check if a give string is a valid JSON Web Token (JWT). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsJWT)] - [[play](https://go.dev/play/p/R6Op7heJbKI)] -- **IsVisa** : check if a give string is a valid visa card number or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsVisa)] - [[play](https://go.dev/play/p/SdS2keOyJsl)] -- **IsMasterCard** : check if a give string is a valid master card number or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsMasterCard)] - [[play](https://go.dev/play/p/CwWBFRrG27b)] -- **IsAmericanExpress** : check if a give string is a valid american expression card number or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAmericanExpress)] - [[play](https://go.dev/play/p/HIDFpcOdpkd)] -- **IsUnionPay** : check if a give string is a valid union pay number or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsUnionPay)] - [[play](https://go.dev/play/p/CUHPEwEITDf)] -- **IsChinaUnionPay** : check if a give string is a valid china union pay number or not. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChinaUnionPay)] - [[play](https://go.dev/play/p/yafpdxLiymu)] -- **IsPassport** : Passport validation(using regex). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsPassport)] - [[play](https://go.dev/play/p/dvOiV2BW7Aw)] -- **IsChineseHMPassport** : Mainland travel permit for Hong Kong, Macao validation (using regex). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseHMPassport)] - [[play](https://go.dev/play/p/xKG6spQTcY0)] +- **ContainChinese** : check if the string contain mandarin chinese. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainChinese)] + [[play](https://go.dev/play/p/7DpU0uElYeM)] +- **ContainLetter** : check if the string contain at least one letter. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainLetter)] + [[play](https://go.dev/play/p/lqFD04Yyewp)] +- **ContainLower** : check if the string contain at least one lower case letter a-z. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainLower)] + [[play](https://go.dev/play/p/Srqi1ItvnAA)] +- **ContainUpper** : check if the string contain at least one upper case letter A-Z. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainUpper)] + [[play](https://go.dev/play/p/CmWeBEk27-z)] +- **IsAlpha** : checks if the string contains only letters (a-zA-Z). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAlpha)] + [[play](https://go.dev/play/p/7Q5sGOz2izQ)] +- **IsAllUpper** : check if the string is all upper case letters A-Z. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAllUpper)] + [[play](https://go.dev/play/p/ZHctgeK1n4Z)] +- **IsAllLower** : check if the string is all lower case letters a-z. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAllLower)] + [[play](https://go.dev/play/p/GjqCnOfV6cM)] +- **IsBase64** : check if the string is base64 string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBase64)] + [[play](https://go.dev/play/p/sWHEySAt6hl)] +- **IsChineseMobile** : check if the string is chinese mobile number. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseMobile)] + [[play](https://go.dev/play/p/GPYUlGTOqe3)] +- **IsChineseIdNum** : check if the string is chinese id card. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseIdNum)] + [[play](https://go.dev/play/p/d8EWhl2UGDF)] +- **IsChinesePhone** : check if the string is chinese phone number.(xxx-xxxxxxxx or xxxx-xxxxxxx.) + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChinesePhone)] + [[play](https://go.dev/play/p/RUD_-7YZJ3I)] +- **IsCreditCard** : check if the string is credit card. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsCreditCard)] + [[play](https://go.dev/play/p/sNwwL6B0-v4)] +- **IsDns** : check if the string is dns. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsDns)] + [[play](https://go.dev/play/p/jlYApVLLGTZ)] +- **IsEmail** : check if the string is a email address. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsEmail)] + [[play](https://go.dev/play/p/HVQ5LAe-vFz)] +- **IsEmptyString** : check if the string is empty. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsEmptyString)] + [[play](https://go.dev/play/p/dpzgUjFnBCX)] +- **IsFloat** : check if the value is float(float32, float34) or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsFloat)] + [[play](https://go.dev/play/p/vsyG-sxr99_Z)] +- **IsFloatStr** : check if the string can convert to a float. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsFloatStr)] + [[play](https://go.dev/play/p/LOYwS_Oyl7U)] +- **IsNumber** : check if the value is number(integer, float) or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsNumber)] + [[play](https://go.dev/play/p/mdJHOAvtsvF)] +- **IsNumberStr** : check if the string can convert to a number. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsNumberStr)] + [[play](https://go.dev/play/p/LzaKocSV79u)] +- **IsAlphaNumeric** : check if the string is alphanumeric. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAlphaNumeric)] + [[play](https://go.dev/play/p/RHeESLrLg9c)] +- **IsJSON** : check if the string is valid JSON. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsJSON)] + [[play](https://go.dev/play/p/8Kip1Itjiil)] +- **IsRegexMatch** : check if the string match the regexp. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsRegexMatch)] + [[play](https://go.dev/play/p/z_XeZo_litG)] +- **IsInt** : check if the string can convert to a number. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsInt)] + [[play](https://go.dev/play/p/eFoIHbgzl-z)] +- **IsIntStr** : check if the string can convert to a integer. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIntStr)] + [[play](https://go.dev/play/p/jQRtFv-a0Rk)] +- **IsIp** : check if the string is ip. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIp)] + [[play](https://go.dev/play/p/FgcplDvmxoD)] +- **IsIpV4** : check if the string is ipv4. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpV4)] + [[play](https://go.dev/play/p/zBGT99EjaIu)] +- **IsIpV6** : check if the string is ipv6. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpV6)] + [[play](https://go.dev/play/p/AHA0r0AzIdC)] +- **IsIpPort** : check if the string is ip:port. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpPort)] + [[play](https://go.dev/play/p/xUmls_b9L29)] +- **IsStrongPassword** : check if the string is strong password. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsStrongPassword)] + [[play](https://go.dev/play/p/QHdVcSQ3uDg)] +- **IsUrl** : check if the string is url. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsUrl)] + [[play](https://go.dev/play/p/pbJGa7F98Ka)] +- **IsWeakPassword** : check if the string is weak password. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsWeakPassword)] + [[play](https://go.dev/play/p/wqakscZH5gH)] +- **IsZeroValue** : check if value is a zero value. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsZeroValue)] + [[play](https://go.dev/play/p/UMrwaDCi_t4)] +- **IsGBK** : check if data encoding is gbk. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsGBK)] + [[play](https://go.dev/play/p/E2nt3unlmzP)] +- **IsASCII** : checks if string is all ASCII char. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsASCII)] + [[play](https://go.dev/play/p/hfQNPLX0jNa)] +- **IsPrintable** : checks if string is all printable chars. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsPrintable)] + [[play](https://go.dev/play/p/Pe1FE2gdtTP)] +- **IsBin** : check if a give string is a valid binary value or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBin)] + [[play](https://go.dev/play/p/ogPeg2XJH4P)] +- **IsHex** : check if a give string is a valid hexadecimal value or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsHex)] + [[play](https://go.dev/play/p/M2qpHbEwmm7)] +- **IsBase64URL** : check if a give string is a valid URL-safe Base64 encoded string. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBase64URL)] + [[play](https://go.dev/play/p/vhl4mr8GZ6S)] +- **IsJWT** : check if a give string is a valid JSON Web Token (JWT). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsJWT)] + [[play](https://go.dev/play/p/R6Op7heJbKI)] +- **IsVisa** : check if a give string is a valid visa card number or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsVisa)] + [[play](https://go.dev/play/p/SdS2keOyJsl)] +- **IsMasterCard** : check if a give string is a valid master card number or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsMasterCard)] + [[play](https://go.dev/play/p/CwWBFRrG27b)] +- **IsAmericanExpress** : check if a give string is a valid american expression card number or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAmericanExpress)] + [[play](https://go.dev/play/p/HIDFpcOdpkd)] +- **IsUnionPay** : check if a give string is a valid union pay number or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsUnionPay)] + [[play](https://go.dev/play/p/CUHPEwEITDf)] +- **IsChinaUnionPay** : check if a give string is a valid china union pay number or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChinaUnionPay)] + [[play](https://go.dev/play/p/yafpdxLiymu)] +- **IsPassport** : Passport validation(using regex). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsPassport)] + [[play](https://go.dev/play/p/dvOiV2BW7Aw)] +- **IsChineseHMPassport** : Mainland travel permit for Hong Kong, Macao validation (using regex). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseHMPassport)] + [[play](https://go.dev/play/p/xKG6spQTcY0)]

27. Xerror package implements helpers for errors.        index

@@ -2448,48 +2448,48 @@ import "github.com/duke-git/lancet/v2/xerror" #### Function list: -- **New** : creates a new XError pointer instance with message. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#New)] - [[play](https://go.dev/play/p/w4oWZts7q7f)] -- **Wrap** : creates a new XError pointer instance based on error object, and add message. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#Wrap)] - [[play](https://go.dev/play/p/5385qT2dCi4)] -- **Unwrap** : returns unwrapped XError from err by errors.As. If no XError, returns nil. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#Unwrap)] - [[play](https://go.dev/play/p/LKMLep723tu)] -- **XError_Wrap** : creates a new XError and copy message and id to new one. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Wrap)] - [[play](https://go.dev/play/p/RpjJ5u5sc97)] -- **XError_Unwrap** : Compatible with github.com/pkg/errors. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Unwrap)] - [[play](https://go.dev/play/p/VUXJ8BST4c6)] -- **XError_With** : adds key and value related to the XError object. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_With)] - [[play](https://go.dev/play/p/ow8UISXX_Dp)] -- **XError_Id** : sets XError object id to check equality in XError.Is. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Id)] - [[play](https://go.dev/play/p/X6HBlsy58U9)] -- **XError_Is** : checks if target error is XError and Error.id of two errors are matched. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Is)] - [[play](https://go.dev/play/p/X6HBlsy58U9)] -- **XError_Values** : returns map of key and value that is set by XError.With function. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Values)] - [[play](https://go.dev/play/p/ow8UISXX_Dp)] -- **XError_StackTrace** : returns stack trace which is compatible with pkg/errors. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_StackTrace)] - [[play](https://go.dev/play/p/6FAvSQpa7pc)] -- **XError_Info** : returns information of xerror, which can be printed. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Info)] - [[play](https://go.dev/play/p/1ZX0ME1F-Jb)] -- **XError_Error** : implements standard error interface. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Error)] - [[play](https://go.dev/play/p/w4oWZts7q7f)] -- **TryUnwrap** : check if err is nil then it returns a valid value. If err is not nil, TryUnwrap panics with err. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#TryUnwrap)] - [[play](https://go.dev/play/p/acyZVkNZEeW)] -- **TryCatch** : simple simulation of Java-style try-catch. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#TryCatch)] - [[play](https://go.dev/play/p/D5Mdb0mRj0P)] +- **New** : creates a new XError pointer instance with message. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#New)] + [[play](https://go.dev/play/p/w4oWZts7q7f)] +- **Wrap** : creates a new XError pointer instance based on error object, and add message. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#Wrap)] + [[play](https://go.dev/play/p/5385qT2dCi4)] +- **Unwrap** : returns unwrapped XError from err by errors.As. If no XError, returns nil. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#Unwrap)] + [[play](https://go.dev/play/p/LKMLep723tu)] +- **XError_Wrap** : creates a new XError and copy message and id to new one. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Wrap)] + [[play](https://go.dev/play/p/RpjJ5u5sc97)] +- **XError_Unwrap** : Compatible with github.com/pkg/errors. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Unwrap)] + [[play](https://go.dev/play/p/VUXJ8BST4c6)] +- **XError_With** : adds key and value related to the XError object. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_With)] + [[play](https://go.dev/play/p/ow8UISXX_Dp)] +- **XError_Id** : sets XError object id to check equality in XError.Is. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Id)] + [[play](https://go.dev/play/p/X6HBlsy58U9)] +- **XError_Is** : checks if target error is XError and Error.id of two errors are matched. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Is)] + [[play](https://go.dev/play/p/X6HBlsy58U9)] +- **XError_Values** : returns map of key and value that is set by XError.With function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Values)] + [[play](https://go.dev/play/p/ow8UISXX_Dp)] +- **XError_StackTrace** : returns stack trace which is compatible with pkg/errors. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_StackTrace)] + [[play](https://go.dev/play/p/6FAvSQpa7pc)] +- **XError_Info** : returns information of xerror, which can be printed. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Info)] + [[play](https://go.dev/play/p/1ZX0ME1F-Jb)] +- **XError_Error** : implements standard error interface. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Error)] + [[play](https://go.dev/play/p/w4oWZts7q7f)] +- **TryUnwrap** : check if err is nil then it returns a valid value. If err is not nil, TryUnwrap panics with err. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#TryUnwrap)] + [[play](https://go.dev/play/p/acyZVkNZEeW)] +- **TryCatch** : simple simulation of Java-style try-catch. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#TryCatch)] + [[play](https://go.dev/play/p/D5Mdb0mRj0P)] ## How to Contribute diff --git a/README_zh-CN.md b/README_zh-CN.md index 638f8fb..c77c8e6 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -4,7 +4,7 @@
![Go version](https://img.shields.io/badge/go-%3E%3Dv1.18-9cf) -[![Release](https://img.shields.io/badge/release-2.3.9-green.svg)](https://github.com/duke-git/lancet/releases) +[![Release](https://img.shields.io/badge/release-2.4.0-green.svg)](https://github.com/duke-git/lancet/releases) [![GoDoc](https://godoc.org/github.com/duke-git/lancet/v2?status.svg)](https://pkg.go.dev/github.com/duke-git/lancet/v2) [![Go Report Card](https://goreportcard.com/badge/github.com/duke-git/lancet/v2)](https://goreportcard.com/report/github.com/duke-git/lancet/v2) [![test](https://github.com/duke-git/lancet/actions/workflows/codecov.yml/badge.svg?branch=main&event=push)](https://github.com/duke-git/lancet/actions/workflows/codecov.yml) @@ -23,10 +23,10 @@ ## 特性 -- 👏 全面、高效、可复用。 -- 💪 700+常用 go 工具函数,支持 string、slice、datetime、net、crypt... -- 💅 只依赖 go 标准库和 golang.org/x。 -- 🌍 所有导出函数单元测试覆盖率 100%。 +- 👏 全面、高效、可复用。 +- 💪 700+常用 go 工具函数,支持 string、slice、datetime、net、crypt... +- 💅 只依赖 go 标准库和 golang.org/x。 +- 🌍 所有导出函数单元测试覆盖率 100%。 ## 安装 @@ -75,33 +75,33 @@ func main() { ### 目录 -- [Algorithm](#user-content-algorithm) -- [Compare](#user-content-compare) -- [Concurrency](#user-content-concurrency) -- [Condition](#user-content-condition) -- [Convertor](#user-content-convertor) -- [Cryptor](#user-content-cryptor) -- [Datetime](#user-content-datetime) -- [Datastructure](#user-content-datastructure) -- [EventBus](#user-content-eventbus) -- [Enum](#user-content-enum) -- [Fileutil](#user-content-fileutil) -- [Formatter](#user-content-formatter) -- [Function](#user-content-function) -- [Maputil](#user-content-maputil) -- [Mathutil](#user-content-mathutil) -- [Netutil](#user-content-netutil) -- [Pointer](#user-content-pointer) -- [Random](#user-content-random) -- [Retry](#user-content-retry) -- [Slice](#user-content-slice) -- [Stream](#user-content-stream) -- [Structs](#user-content-structs) -- [Strutil](#user-content-strutil) -- [System](#user-content-system) -- [Tuple](#user-content-tuple) -- [Validator](#user-content-validator) -- [Xerror](#user-content-xerror) +- [Algorithm](#user-content-algorithm) +- [Compare](#user-content-compare) +- [Concurrency](#user-content-concurrency) +- [Condition](#user-content-condition) +- [Convertor](#user-content-convertor) +- [Cryptor](#user-content-cryptor) +- [Datetime](#user-content-datetime) +- [Datastructure](#user-content-datastructure) +- [EventBus](#user-content-eventbus) +- [Enum](#user-content-enum) +- [Fileutil](#user-content-fileutil) +- [Formatter](#user-content-formatter) +- [Function](#user-content-function) +- [Maputil](#user-content-maputil) +- [Mathutil](#user-content-mathutil) +- [Netutil](#user-content-netutil) +- [Pointer](#user-content-pointer) +- [Random](#user-content-random) +- [Retry](#user-content-retry) +- [Slice](#user-content-slice) +- [Stream](#user-content-stream) +- [Structs](#user-content-structs) +- [Strutil](#user-content-strutil) +- [System](#user-content-system) +- [Tuple](#user-content-tuple) +- [Validator](#user-content-validator) +- [Xerror](#user-content-xerror)

1. algorithm 包实现一些基本查找和排序算法。        回到目录

@@ -111,42 +111,42 @@ import "github.com/duke-git/lancet/v2/algorithm" #### 函数列表: -- **BubbleSort** : 使用冒泡排序算法对切片进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#BubbleSort)] - [[play](https://go.dev/play/p/GNdv7Jg2Taj)] -- **CountSort** : 使用计数排序算法对切片进行排序。不改变原数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#CountSort)] - [[play](https://go.dev/play/p/tB-Umgm0DrP)] -- **HeapSort** : 使用堆排序算法对切片进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#HeapSort)] - [[play](https://go.dev/play/p/u6Iwa1VZS_f)] -- **InsertionSort** : 使用插入排序算法对切片进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#InsertionSort)] - [[play](https://go.dev/play/p/G5LJiWgJJW6)] -- **MergeSort** : 使用合并排序算法对切片进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#MergeSort)] - [[play](https://go.dev/play/p/ydinn9YzUJn)] -- **QuickSort** : 使用快速排序算法对切片进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#QuickSort)] - [[play](https://go.dev/play/p/7Y7c1Elk3ax)] -- **SelectionSort** : 使用选择排序算法对切片进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#SelectionSort)] - [[play](https://go.dev/play/p/oXovbkekayS)] -- **ShellSort** : 使用希尔排序算法对切片进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#ShellSort)] - [[play](https://go.dev/play/p/3ibkszpJEu3)] -- **BinarySearch** : 返回排序切片中目标值的索引,使用二分搜索(递归调用)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#BinarySearch)] - [[play](https://go.dev/play/p/t6MeGiUSN47)] -- **BinaryIterativeSearch** :返回排序切片中目标值的索引,使用二分搜索(非递归)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#BinaryIterativeSearch)] - [[play](https://go.dev/play/p/Anozfr8ZLH3)] -- **LinearSearch** : 基于传入的相等函数返回切片中目标值的索引。(线性查找) - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#LinearSearch)] - [[play](https://go.dev/play/p/IsS7rgn5s3x)] -- **LRUCache** : 应用 lru 算法实现内存缓存. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#LRUCache)] - [[play](https://go.dev/play/p/-EZjgOURufP)] +- **BubbleSort** : 使用冒泡排序算法对切片进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#BubbleSort)] + [[play](https://go.dev/play/p/GNdv7Jg2Taj)] +- **CountSort** : 使用计数排序算法对切片进行排序。不改变原数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#CountSort)] + [[play](https://go.dev/play/p/tB-Umgm0DrP)] +- **HeapSort** : 使用堆排序算法对切片进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#HeapSort)] + [[play](https://go.dev/play/p/u6Iwa1VZS_f)] +- **InsertionSort** : 使用插入排序算法对切片进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#InsertionSort)] + [[play](https://go.dev/play/p/G5LJiWgJJW6)] +- **MergeSort** : 使用合并排序算法对切片进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#MergeSort)] + [[play](https://go.dev/play/p/ydinn9YzUJn)] +- **QuickSort** : 使用快速排序算法对切片进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#QuickSort)] + [[play](https://go.dev/play/p/7Y7c1Elk3ax)] +- **SelectionSort** : 使用选择排序算法对切片进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#SelectionSort)] + [[play](https://go.dev/play/p/oXovbkekayS)] +- **ShellSort** : 使用希尔排序算法对切片进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#ShellSort)] + [[play](https://go.dev/play/p/3ibkszpJEu3)] +- **BinarySearch** : 返回排序切片中目标值的索引,使用二分搜索(递归调用)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#BinarySearch)] + [[play](https://go.dev/play/p/t6MeGiUSN47)] +- **BinaryIterativeSearch** :返回排序切片中目标值的索引,使用二分搜索(非递归)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#BinaryIterativeSearch)] + [[play](https://go.dev/play/p/Anozfr8ZLH3)] +- **LinearSearch** : 基于传入的相等函数返回切片中目标值的索引。(线性查找) + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#LinearSearch)] + [[play](https://go.dev/play/p/IsS7rgn5s3x)] +- **LRUCache** : 应用 lru 算法实现内存缓存. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/algorithm.md#LRUCache)] + [[play](https://go.dev/play/p/-EZjgOURufP)]

2. compare 包提供几个轻量级的类型比较函数。       回到目录

@@ -156,26 +156,26 @@ import "github.com/duke-git/lancet/v2/compare" #### 函数列表: -- **Equal** : 检查两个值是否相等(检查类型和值)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#Equal)] - [[play](https://go.dev/play/p/wmVxR-to4lz)] -- **EqualValue** : 检查两个值是否相等(只检查值)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#EqualValue)] - [[play](https://go.dev/play/p/fxnna_LLD9u)] -- **LessThan** : 验证参数`left`的值是否小于参数`right`的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#LessThan)] - [[play](https://go.dev/play/p/cYh7FQQj0ne)] -- **GreaterThan** : 验证参数`left`的值是否大于参数`right`的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#GreaterThan)] - [[play](https://go.dev/play/p/9-NYDFZmIMp)] -- **LessOrEqual** : 验证参数`left`的值是否小于或等于参数`right`的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#LessOrEqual)] - [[play](https://go.dev/play/p/e4T_scwoQzp)] -- **GreaterOrEqual** : 验证参数`left`的值是否大于或等于参数`right`的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#GreaterOrEqual)] - [[play](https://go.dev/play/p/vx8mP0U8DFk)] -- **InDelta** : 检查增量内两个值是否相等。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#InDelta)] +- **Equal** : 检查两个值是否相等(检查类型和值)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#Equal)] + [[play](https://go.dev/play/p/wmVxR-to4lz)] +- **EqualValue** : 检查两个值是否相等(只检查值)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#EqualValue)] + [[play](https://go.dev/play/p/fxnna_LLD9u)] +- **LessThan** : 验证参数`left`的值是否小于参数`right`的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#LessThan)] + [[play](https://go.dev/play/p/cYh7FQQj0ne)] +- **GreaterThan** : 验证参数`left`的值是否大于参数`right`的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#GreaterThan)] + [[play](https://go.dev/play/p/9-NYDFZmIMp)] +- **LessOrEqual** : 验证参数`left`的值是否小于或等于参数`right`的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#LessOrEqual)] + [[play](https://go.dev/play/p/e4T_scwoQzp)] +- **GreaterOrEqual** : 验证参数`left`的值是否大于或等于参数`right`的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#GreaterOrEqual)] + [[play](https://go.dev/play/p/vx8mP0U8DFk)] +- **InDelta** : 检查增量内两个值是否相等。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/compare.md#InDelta)]

3. concurrency 包含一些支持并发编程的功能。例如:goroutine, channel, async 等。       回到目录

@@ -185,60 +185,60 @@ import "github.com/duke-git/lancet/v2/concurrency" #### 函数列表: -- **NewChannel** : 返回一个 Channel 指针实例。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewChannel)] - [[play](https://go.dev/play/p/7aB4KyMMp9A)] -- **Bridge** : 将多个 channel 链接到一个 channel,直到取消上下文。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/Bridge.md#NewChannel)] - [[play](https://go.dev/play/p/qmWSy1NVF-Y)] -- **FanIn** : 将多个 channel 合并为一个 channel,直到取消上下文。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#FanIn)] - [[play](https://go.dev/play/p/2VYFMexEvTm)] -- **Generate** : 根据传入的值,生成 channel。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Generate)] - [[play](https://go.dev/play/p/7aB4KyMMp9A)] -- **Or** : 将一个或多个 channel 读取到一个 channel 中,当任何读取 channel 关闭时将结束读取。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Or)] - [[play](https://go.dev/play/p/Wqz9rwioPww)] -- **OrDone** : 将一个 channel 读入另一个 channel,直到取消上下文。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#OrDone)] - [[play](https://go.dev/play/p/lm_GoS6aDjo)] -- **Repeat** : 返回一个 channel,将参数`values`重复放入 channel,直到取消上下文。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Repeat)] - [[play](https://go.dev/play/p/k5N_ALVmYjE)] -- **RepeatFn** : 返回一个 channel,重复执行函数 fn,并将结果放入返回的 channel,直到取消上下文。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#RepeatFn)] - [[play](https://go.dev/play/p/4J1zAWttP85)] -- **Take** : 返回一个 channel,其值从另一个 channel 获取,直到取消上下文。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Take)] - [[play](https://go.dev/play/p/9Utt-1pDr2J)] -- **Tee** : 将一个 channel 分成两个 channel,直到取消上下文。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Tee)] - [[play](https://go.dev/play/p/3TQPKnCirrP)] -- **NewKeyedLocker** : NewKeyedLocker 创建一个新的 KeyedLocker,并为锁的过期设置指定的 TTL。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewKeyedLocker)] - [[play](https://go.dev/play/p/GzeyC33T5rw)] -- **Do** :为指定的键获取锁并执行提供的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Do)] - [[play](https://go.dev/play/p/GzeyC33T5rw)] -- **NewRWKeyedLocker** :RWKeyedLocker 是一个简单的键值读写锁实现,允许非阻塞的锁获取。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewRWKeyedLocker)] - [[play](https://go.dev/play/p/ZrCr8sMo77T)] -- **RLock** : 为指定的键获取读锁并执行提供的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#RLock)] - [[play](https://go.dev/play/p/ZrCr8sMo77T)] -- **Lock** : 为指定的键获取锁并执行提供的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Lock)] - [[play](https://go.dev/play/p/WgAcXbOPKGk)] -- **NewTryKeyedLocker** : 创建一个 TryKeyedLocker 实例,TryKeyedLocker 是 KeyedLocker 的非阻塞版本。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewTryKeyedLocker)] - [[play](https://go.dev/play/p/VG9qLvyetE2)] -- **TryLock** : TryLock 尝试获取指定键的锁。如果锁成功获取,则返回 true,否则返回 false。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#TryLock)] - [[play](https://go.dev/play/p/VG9qLvyetE2)] -- **Unlock** : 释放指定键的锁。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Unlock)] - [[play](https://go.dev/play/p/VG9qLvyetE2)] +- **NewChannel** : 返回一个 Channel 指针实例。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewChannel)] + [[play](https://go.dev/play/p/7aB4KyMMp9A)] +- **Bridge** : 将多个 channel 链接到一个 channel,直到取消上下文。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/Bridge.md#NewChannel)] + [[play](https://go.dev/play/p/qmWSy1NVF-Y)] +- **FanIn** : 将多个 channel 合并为一个 channel,直到取消上下文。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#FanIn)] + [[play](https://go.dev/play/p/2VYFMexEvTm)] +- **Generate** : 根据传入的值,生成 channel。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Generate)] + [[play](https://go.dev/play/p/7aB4KyMMp9A)] +- **Or** : 将一个或多个 channel 读取到一个 channel 中,当任何读取 channel 关闭时将结束读取。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Or)] + [[play](https://go.dev/play/p/Wqz9rwioPww)] +- **OrDone** : 将一个 channel 读入另一个 channel,直到取消上下文。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#OrDone)] + [[play](https://go.dev/play/p/lm_GoS6aDjo)] +- **Repeat** : 返回一个 channel,将参数`values`重复放入 channel,直到取消上下文。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Repeat)] + [[play](https://go.dev/play/p/k5N_ALVmYjE)] +- **RepeatFn** : 返回一个 channel,重复执行函数 fn,并将结果放入返回的 channel,直到取消上下文。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#RepeatFn)] + [[play](https://go.dev/play/p/4J1zAWttP85)] +- **Take** : 返回一个 channel,其值从另一个 channel 获取,直到取消上下文。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Take)] + [[play](https://go.dev/play/p/9Utt-1pDr2J)] +- **Tee** : 将一个 channel 分成两个 channel,直到取消上下文。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Tee)] + [[play](https://go.dev/play/p/3TQPKnCirrP)] +- **NewKeyedLocker** : NewKeyedLocker 创建一个新的 KeyedLocker,并为锁的过期设置指定的 TTL。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewKeyedLocker)] + [[play](https://go.dev/play/p/GzeyC33T5rw)] +- **Do** :为指定的键获取锁并执行提供的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Do)] + [[play](https://go.dev/play/p/GzeyC33T5rw)] +- **NewRWKeyedLocker** :RWKeyedLocker 是一个简单的键值读写锁实现,允许非阻塞的锁获取。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewRWKeyedLocker)] + [[play](https://go.dev/play/p/ZrCr8sMo77T)] +- **RLock** : 为指定的键获取读锁并执行提供的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#RLock)] + [[play](https://go.dev/play/p/ZrCr8sMo77T)] +- **Lock** : 为指定的键获取锁并执行提供的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Lock)] + [[play](https://go.dev/play/p/WgAcXbOPKGk)] +- **NewTryKeyedLocker** : 创建一个 TryKeyedLocker 实例,TryKeyedLocker 是 KeyedLocker 的非阻塞版本。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#NewTryKeyedLocker)] + [[play](https://go.dev/play/p/VG9qLvyetE2)] +- **TryLock** : TryLock 尝试获取指定键的锁。如果锁成功获取,则返回 true,否则返回 false。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#TryLock)] + [[play](https://go.dev/play/p/VG9qLvyetE2)] +- **Unlock** : 释放指定键的锁。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/concurrency.md#Unlock)] + [[play](https://go.dev/play/p/VG9qLvyetE2)]

4. condition 包含一些用于条件判断的函数。       回到目录

@@ -248,30 +248,30 @@ import "github.com/duke-git/lancet/v2/condition" #### 函数列表: -- **Bool** : 返回传入参数的 bool 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Bool)] - [[play](https://go.dev/play/p/ETzeDJRSvhm)] -- **And** : 逻辑且操作,当切仅当 a 和 b 都为 true 时返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#And)] - [[play](https://go.dev/play/p/W1SSUmt6pvr)] -- **Or** : 逻辑或操作,当切仅当 a 和 b 都为 false 时返回 false。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Or)] - [[play](https://go.dev/play/p/UlQTxHaeEkq)] -- **Xor** : 逻辑异或操作,a 和 b 相同返回 false,a 和 b 不相同返回 true - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Xor)] - [[play](https://go.dev/play/p/gObZrW7ZbG8)] -- **Nor** : 异或的取反操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Nor)] - [[play](https://go.dev/play/p/g2j08F_zZky)] -- **Xnor** : 如果 a 和 b 都是真的或 a 和 b 均是假的,则返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Xnor)] - [[play](https://go.dev/play/p/OuDB9g51643)] -- **Nand** : 如果 a 和 b 都为真,返回 false,否则返回 true - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Nand)] - [[play](https://go.dev/play/p/vSRMLxLIbq8)] -- **TernaryOperator** : 三元运算符。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#TernaryOperator)] - [[play](https://go.dev/play/p/ElllPZY0guT)] +- **Bool** : 返回传入参数的 bool 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Bool)] + [[play](https://go.dev/play/p/ETzeDJRSvhm)] +- **And** : 逻辑且操作,当切仅当 a 和 b 都为 true 时返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#And)] + [[play](https://go.dev/play/p/W1SSUmt6pvr)] +- **Or** : 逻辑或操作,当切仅当 a 和 b 都为 false 时返回 false。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Or)] + [[play](https://go.dev/play/p/UlQTxHaeEkq)] +- **Xor** : 逻辑异或操作,a 和 b 相同返回 false,a 和 b 不相同返回 true + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Xor)] + [[play](https://go.dev/play/p/gObZrW7ZbG8)] +- **Nor** : 异或的取反操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Nor)] + [[play](https://go.dev/play/p/g2j08F_zZky)] +- **Xnor** : 如果 a 和 b 都是真的或 a 和 b 均是假的,则返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Xnor)] + [[play](https://go.dev/play/p/OuDB9g51643)] +- **Nand** : 如果 a 和 b 都为真,返回 false,否则返回 true + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#Nand)] + [[play](https://go.dev/play/p/vSRMLxLIbq8)] +- **TernaryOperator** : 三元运算符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/condition.md#TernaryOperator)] + [[play](https://go.dev/play/p/ElllPZY0guT)]

5. convertor 转换器包支持一些常见的数据类型转换。       回到目录

@@ -281,93 +281,93 @@ import "github.com/duke-git/lancet/v2/convertor" #### 函数列表: -- **ColorHexToRGB** : 颜色值十六进制转 rgb。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ColorHexToRGB)] - [[play](https://go.dev/play/p/o7_ft-JCJBV)] -- **ColorRGBToHex** : 颜色值 rgb 转十六进制。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ColorRGBToHex)] - [[play](https://go.dev/play/p/nzKS2Ro87J1)] -- **ToBool** : 字符串转布尔类型,使用 strconv.ParseBool。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToBool)] - [[play](https://go.dev/play/p/ARht2WnGdIN)] -- **ToBytes** : interface 转字节切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToBytes)] - [[play](https://go.dev/play/p/fAMXYFDvOvr)] -- **ToChar** : 字符串转字符切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToChar)] - [[play](https://go.dev/play/p/JJ1SvbFkVdM)] -- **ToChannel** : 将切片转为只读 channel。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToChannel)] - [[play](https://go.dev/play/p/hOx_oYZbAnL)] -- **ToFloat** : 将 interface 转成 float64 类型,如果参数无法转换,会返回 0.0 和 error。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToFloat)] - [[play](https://go.dev/play/p/4YTmPCibqHJ)] -- **ToInt** : 将 interface 转成 int64 类型,如果参数无法转换,会返回 0 和 error。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToInt)] - [[play](https://go.dev/play/p/9_h9vIt-QZ_b)] -- **ToJson** : 将 interface 转成 json 字符串,如果参数无法转换,会返回""和 error。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToJson)] - [[play](https://go.dev/play/p/2rLIkMmXWvR)] -- **ToMap** : 将切片转为 map。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToMap)] - [[play](https://go.dev/play/p/tVFy7E-t24l)] -- **ToPointer** : 返回传入值的指针。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToPointer)] - [[play](https://go.dev/play/p/ASf_etHNlw1)] -- **ToPointers** : 将值的切片转换为指针的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToPointers)] - [[play](https://go.dev/play/p/ZUoXd2i5ZkV)] -- **FromPointer** : 返回指针所指向的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#FromPointer)] - [[play](https://go.dev/play/p/wAp90V7Zu6g)] -- **FromPointers** : 将指针的切片转换为值的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#FromPointers)] - [[play](https://go.dev/play/p/qIPsyYtNy3Q)] -- **ToString** : 将值转换为字符串,对于数字、字符串、[]byte,将转换为字符串。 对于其他类型(切片、映射、数组、结构)将调用 json.Marshal。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToString)] - [[play](https://go.dev/play/p/nF1zOOslpQq)] -- **StructToMap** : 将 struct 转成 map,只会转换 struct 中可导出的字段。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#StructToMap)] - [[play](https://go.dev/play/p/KYGYJqNUBOI)] -- **MapToSlice** : map 中 key 和 value 执行函数 iteratee 后,转为切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#MapToSlice)] - [[play](https://go.dev/play/p/dmX4Ix5V6Wl)] -- **EncodeByte** : 将传入的 data 编码成字节切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#EncodeByte)] - [[play](https://go.dev/play/p/DVmM1G5JfuP)] -- **DecodeByte** : 解码字节切片到目标对象,目标对象需要传入一个指针实例。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#DecodeByte)] - [[play](https://go.dev/play/p/zI6xsmuQRbn)] -- **DeepClone** : 创建一个传入值的深拷贝, 无法克隆结构体的非导出字段。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#DeepClone)] - [[play](https://go.dev/play/p/j4DP5dquxnk)] -- **CopyProperties** : 拷贝不同结构体之间的同名字段。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#CopyProperties)] - [[play](https://go.dev/play/p/oZujoB5Sgg5)] -- **ToInterface** : 将反射值转换成对应的 interface 类型。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToInterface)] - [[play](https://go.dev/play/p/syqw0-WG7Xd)] -- **Utf8ToGbk** : utf8 编码转 GBK 编码。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#Utf8ToGbk)] - [[play](https://go.dev/play/p/9FlIaFLArIL)] -- **GbkToUtf8** : GBK 编码转 utf8 编码。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#GbkToUtf8)] - [[play](https://go.dev/play/p/OphmHCN_9u8)] -- **ToStdBase64** : 将值转换为 StdBase64 编码的字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToStdBase64)] - [[play](https://go.dev/play/p/_fLJqJD3NMo)] -- **ToUrlBase64** : 将值转换为 url Base64 编码的字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToUrlBase64)] - [[play](https://go.dev/play/p/C_d0GlvEeUR)] -- **ToRawStdBase64** : 将值转换为 RawStdBase64 编码的字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToRawStdBase64)] - [[play](https://go.dev/play/p/wSAr3sfkDcv)] -- **ToRawUrlBase64** : 将值转换为 RawUrlBase64 编码的字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToRawUrlBase64)] - [[play](https://go.dev/play/p/HwdDPFcza1O)] -- **ToBigInt** : 将整数转为\*big.Int。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToBigInt)] - [[play](https://go.dev/play/p/X3itkCxwB_x)] +- **ColorHexToRGB** : 颜色值十六进制转 rgb。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ColorHexToRGB)] + [[play](https://go.dev/play/p/o7_ft-JCJBV)] +- **ColorRGBToHex** : 颜色值 rgb 转十六进制。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ColorRGBToHex)] + [[play](https://go.dev/play/p/nzKS2Ro87J1)] +- **ToBool** : 字符串转布尔类型,使用 strconv.ParseBool。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToBool)] + [[play](https://go.dev/play/p/ARht2WnGdIN)] +- **ToBytes** : interface 转字节切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToBytes)] + [[play](https://go.dev/play/p/fAMXYFDvOvr)] +- **ToChar** : 字符串转字符切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToChar)] + [[play](https://go.dev/play/p/JJ1SvbFkVdM)] +- **ToChannel** : 将切片转为只读 channel。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToChannel)] + [[play](https://go.dev/play/p/hOx_oYZbAnL)] +- **ToFloat** : 将 interface 转成 float64 类型,如果参数无法转换,会返回 0.0 和 error。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToFloat)] + [[play](https://go.dev/play/p/4YTmPCibqHJ)] +- **ToInt** : 将 interface 转成 int64 类型,如果参数无法转换,会返回 0 和 error。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToInt)] + [[play](https://go.dev/play/p/9_h9vIt-QZ_b)] +- **ToJson** : 将 interface 转成 json 字符串,如果参数无法转换,会返回""和 error。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToJson)] + [[play](https://go.dev/play/p/2rLIkMmXWvR)] +- **ToMap** : 将切片转为 map。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToMap)] + [[play](https://go.dev/play/p/tVFy7E-t24l)] +- **ToPointer** : 返回传入值的指针。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToPointer)] + [[play](https://go.dev/play/p/ASf_etHNlw1)] +- **ToPointers** : 将值的切片转换为指针的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToPointers)] + [[play](https://go.dev/play/p/ZUoXd2i5ZkV)] +- **FromPointer** : 返回指针所指向的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#FromPointer)] + [[play](https://go.dev/play/p/wAp90V7Zu6g)] +- **FromPointers** : 将指针的切片转换为值的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#FromPointers)] + [[play](https://go.dev/play/p/qIPsyYtNy3Q)] +- **ToString** : 将值转换为字符串,对于数字、字符串、[]byte,将转换为字符串。 对于其他类型(切片、映射、数组、结构)将调用 json.Marshal。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToString)] + [[play](https://go.dev/play/p/nF1zOOslpQq)] +- **StructToMap** : 将 struct 转成 map,只会转换 struct 中可导出的字段。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#StructToMap)] + [[play](https://go.dev/play/p/KYGYJqNUBOI)] +- **MapToSlice** : map 中 key 和 value 执行函数 iteratee 后,转为切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#MapToSlice)] + [[play](https://go.dev/play/p/dmX4Ix5V6Wl)] +- **EncodeByte** : 将传入的 data 编码成字节切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#EncodeByte)] + [[play](https://go.dev/play/p/DVmM1G5JfuP)] +- **DecodeByte** : 解码字节切片到目标对象,目标对象需要传入一个指针实例。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#DecodeByte)] + [[play](https://go.dev/play/p/zI6xsmuQRbn)] +- **DeepClone** : 创建一个传入值的深拷贝, 无法克隆结构体的非导出字段。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#DeepClone)] + [[play](https://go.dev/play/p/j4DP5dquxnk)] +- **CopyProperties** : 拷贝不同结构体之间的同名字段。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#CopyProperties)] + [[play](https://go.dev/play/p/oZujoB5Sgg5)] +- **ToInterface** : 将反射值转换成对应的 interface 类型。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToInterface)] + [[play](https://go.dev/play/p/syqw0-WG7Xd)] +- **Utf8ToGbk** : utf8 编码转 GBK 编码。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#Utf8ToGbk)] + [[play](https://go.dev/play/p/9FlIaFLArIL)] +- **GbkToUtf8** : GBK 编码转 utf8 编码。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#GbkToUtf8)] + [[play](https://go.dev/play/p/OphmHCN_9u8)] +- **ToStdBase64** : 将值转换为 StdBase64 编码的字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToStdBase64)] + [[play](https://go.dev/play/p/_fLJqJD3NMo)] +- **ToUrlBase64** : 将值转换为 url Base64 编码的字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToUrlBase64)] + [[play](https://go.dev/play/p/C_d0GlvEeUR)] +- **ToRawStdBase64** : 将值转换为 RawStdBase64 编码的字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToRawStdBase64)] + [[play](https://go.dev/play/p/wSAr3sfkDcv)] +- **ToRawUrlBase64** : 将值转换为 RawUrlBase64 编码的字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToRawUrlBase64)] + [[play](https://go.dev/play/p/HwdDPFcza1O)] +- **ToBigInt** : 将整数转为\*big.Int。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/convertor.md#ToBigInt)] + [[play](https://go.dev/play/p/X3itkCxwB_x)]

6. cryptor 加密包支持数据加密和解密,获取 md5,hash 值。支持 base64, md5, hmac, aes, des, rsa。       回到目录

@@ -377,188 +377,188 @@ import "github.com/duke-git/lancet/v2/cryptor" #### 函数列表: -- **AesEcbEncrypt** : 使用 AES ECB 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesEcbEncrypt)] - [[play](https://go.dev/play/p/zI6xsmuQRbn)] -- **AesEcbDecrypt** : 使用 AES ECB 算法模解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesEcbDecrypt)] - [[play](https://go.dev/play/p/zI6xsmuQRbn)] -- **AesCbcEncrypt** : 使用 AES CBC 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCbcEncrypt)] - [[play](https://go.dev/play/p/IOq_g8_lKZD)] -- **AesCbcDecrypt** : 使用 AES CBC 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCbcDecrypt)] - [[play](https://go.dev/play/p/IOq_g8_lKZD)] -- **AesCtrCryptdeprecated** : 使用 AES CTR 算法模式加密/解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCtrCrypt)] - [[play](https://go.dev/play/p/SpaZO0-5Nsp)] -- **AesCtrEncrypt** : 使用 AES CTR 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCtrCrypt)] - [[play](https://go.dev/play/p/x6pjPAvThRz)] -- **AesCtrDecrypt** : 使用 AES CTR 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCtrCrypt)] - [[play](https://go.dev/play/p/x6pjPAvThRz)] -- **AesCfbEncrypt** : 使用 AES CFB 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCfbEncrypt)] - [[play](https://go.dev/play/p/tfkF10B13kH)] -- **AesCfbDecrypt** : 使用 AES CFB 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCfbDecrypt)] - [[play](https://go.dev/play/p/tfkF10B13kH)] -- **AesOfbEncrypt** : 使用 AES OFB 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesOfbEncrypt)] - [[play](https://go.dev/play/p/VtHxtkUj-3F)] -- **AesOfbDecrypt** : 使用 AES OFB 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesOfbDecrypt)] - [[play](https://go.dev/play/p/VtHxtkUj-3F)] -- **AesGcmEncrypt** : 使用 AES GCM 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesGcmEncrypt)] - [[play](https://go.dev/play/p/rUt0-DmsPCs)] -- **AesGcmDecrypt** : 使用 AES GCM 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesGcmDecrypt)] - [[play](https://go.dev/play/p/rUt0-DmsPCs)] -- **Base64StdEncode** : 将字符串 base64 编码。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Base64StdEncode)] - [[play](https://go.dev/play/p/VOaUyQUreoK)] -- **Base64StdDecode** : 解码 base64 字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Base64StdDecode)] - [[play](https://go.dev/play/p/RWQylnJVgIe)] -- **DesEcbEncrypt** : 使用 DES ECB 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesEcbEncrypt)] - [[play](https://go.dev/play/p/8qivmPeZy4P)] -- **DesEcbDecrypt** : 使用 DES ECB 算法模解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesEcbDecrypt)] - [[play](https://go.dev/play/p/8qivmPeZy4P)] -- **DesCbcEncrypt** : 使用 DES CBC 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCbcEncrypt)] - [[play](https://go.dev/play/p/4cC4QvWfe3_1)] -- **DesCbcDecrypt** : 使用 DES CBC 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCbcDecrypt)] - [[play](https://go.dev/play/p/4cC4QvWfe3_1)] -- **DesCtrCryptdeprecated** : 使用 DES CTR 算法模式加密/解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCtrCrypt)] - [[play](https://go.dev/play/p/9-T6OjKpcdw)] -- **DesCtrEncrypt** : 使用 DES CTR 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCtrEncrypt)] - [[play](https://go.dev/play/p/S6p_WHCgH1d)] -- **DesCtrDecrypt** : 使用 DES CTR 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCtrDecrypt)] - [[play](https://go.dev/play/p/S6p_WHCgH1d)] -- **DesCfbEncrypt** : 使用 DES CFB 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCfbEncrypt)] - [[play](https://go.dev/play/p/y-eNxcFBlxL)] -- **DesCfbDecrypt** : 使用 DES CFB 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCfbDecrypt)] - [[play](https://go.dev/play/p/y-eNxcFBlxL)] -- **DesOfbEncrypt** : 使用 DES OFB 算法模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesOfbEncrypt)] - [[play](https://go.dev/play/p/74KmNadjN1J)] -- **DesOfbDecrypt** : 使用 DES OFB 算法模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesOfbDecrypt)] - [[play](https://go.dev/play/p/74KmNadjN1J)] -- **HmacMd5** : 返回字符串 md5 hmac 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacMd5)] - [[play](https://go.dev/play/p/uef0q1fz53I)] -- **HmacMd5WithBase64** : 获取字符串 md5 hmac base64 字符串值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacMd5WithBase64)] - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacMd5WithBase64)] -- **HmacSha1** : 返回字符串 sha1 hmac 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha1)] - [[play](https://go.dev/play/p/1UI4oQ4WXKM)] -- **HmacSha1WithBase64** : 获取字符串的 sha1 base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha1WithBase64)] - [[play](https://go.dev/play/p/47JmmGrnF7B)] -- **HmacSha256** : 返回字符串 sha256 hmac 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha256)] - [[play](https://go.dev/play/p/HhpwXxFhhC0)] -- **HmacSha256WithBase64** : 获取字符串 sha256 hmac base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha256WithBase64)] - [[play](https://go.dev/play/p/EKbkUvPTLwO)] -- **HmacSha512** : 返回字符串 sha256 hmac 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha512)] - [[play](https://go.dev/play/p/59Od6m4A0Ud)] -- **HmacSha512WithBase64** : 获取字符串 sha512 hmac base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha512WithBase64)] - [[play](https://go.dev/play/p/c6dSe3E2ydU)] -- **Md5Byte** : 返回 byte slice 的 md5 值. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5Byte)] - [[play](https://go.dev/play/p/suraalH8lyC)] -- **Md5ByteWithBase64** : 获取 byte slice 的 md5 base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5ByteWithBase64)] - [[play](https://go.dev/play/p/Tcb-Z7LN2ax)] -- **Md5String** : 返回字符串 md5 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5String)] - [[play](https://go.dev/play/p/1bLcVetbTOI)] -- **Md5StringWithBase64** : 获取字符串 md5 base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5StringWithBase64)] - [[play](https://go.dev/play/p/Lx4gH7Vdr5_y)] -- **Md5File** : 返回文件 md5 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5File)] -- **Sha1** : 返回字符串 sha1 哈希值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha1)] - [[play](https://go.dev/play/p/_m_uoD1deMT)] -- **Sha1WithBase64** : 获取字符串 sha1 base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha1WithBase64)] - [[play](https://go.dev/play/p/fSyx-Gl2l2-)] -- **Sha256** :返回字符串 sha256 哈希值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha256)] - [[play](https://go.dev/play/p/tU9tfBMIAr1)] -- **Sha256WithBase64** : 获取字符串 sha256 base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha256WithBase64)] - [[play](https://go.dev/play/p/85IXJHIal1k)] -- **Sha512** : 返回字符串 sha512 哈希值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha512)] - [[play](https://go.dev/play/p/3WsvLYZxsHa)] -- **Sha512WithBase64** : 获取字符串 sha512 base64 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha512WithBase64)] - [[play](https://go.dev/play/p/q_fY2rA-k5I)] -- **GenerateRsaKey** : 在当前目录下创建 rsa 私钥文件和公钥文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#GenerateRsaKey)] - [[play](https://go.dev/play/p/zutRHrDqs0X)] -- **RsaEncrypt** : 用公钥文件 ras 加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaEncrypt)] - [[play](https://go.dev/play/p/7_zo6mrx-eX)] -- **RsaDecrypt** : 用私钥文件 rsa 解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaDecrypt)] - [[play](https://go.dev/play/p/7_zo6mrx-eX)] -- **GenerateRsaKeyPair** : 创建 rsa 公钥私钥和 key。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#GenerateRsaKeyPair)] - [[play](https://go.dev/play/p/sSVmkfENKMz)] -- **RsaEncryptOAEP** : rsa OAEP 加密。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaEncryptOAEP)] - [[play](https://go.dev/play/p/sSVmkfENKMz)] -- **RsaDecryptOAEP** : rsa OAEP 解密。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaDecryptOAEP)] - [[play](https://go.dev/play/p/sSVmkfENKMz)] -- **RsaSign** : 应用 RSA 算法签名数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaSign)] - [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] -- **RsaVerifySign** : 验证数据的签名是否符合 RSA 算法。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaVerifySign)] - [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] -- **GenerateSm2Key** : 生成 SM2 公钥和私钥。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#GenerateSm2Key)] - [[play](https://go.dev/play/p/bKYMqRLvIx3)] -- **Sm2Encrypt** : 使用 SM2 公钥加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm2Encrypt)] - [[play](https://go.dev/play/p/bKYMqRLvIx3)] -- **Sm2Decrypt** : 使用 SM2 私钥解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm2Decrypt)] - [[play](https://go.dev/play/p/bKYMqRLvIx3)] -- **Sm3** : 返回数据的 SM3 哈希值(256 位)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm3)] - [[play](https://go.dev/play/p/zDAQpteAiOc)] -- **Sm4EcbEncrypt** : 使用 SM4 ECB 模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4EcbEncrypt)] - [[play](https://go.dev/play/p/l5IQxYuuaED)] -- **Sm4EcbDecrypt** : 使用 SM4 ECB 模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4EcbDecrypt)] - [[play](https://go.dev/play/p/l5IQxYuuaED)] -- **Sm4CbcEncrypt** : 使用 SM4 CBC 模式加密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4CbcEncrypt)] - [[play](https://go.dev/play/p/65Q6iYhLRTa)] -- **Sm4CbcDecrypt** : 使用 SM4 CBC 模式解密数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4CbcDecrypt)] - [[play](https://go.dev/play/p/65Q6iYhLRTa)] +- **AesEcbEncrypt** : 使用 AES ECB 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesEcbEncrypt)] + [[play](https://go.dev/play/p/zI6xsmuQRbn)] +- **AesEcbDecrypt** : 使用 AES ECB 算法模解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesEcbDecrypt)] + [[play](https://go.dev/play/p/zI6xsmuQRbn)] +- **AesCbcEncrypt** : 使用 AES CBC 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCbcEncrypt)] + [[play](https://go.dev/play/p/IOq_g8_lKZD)] +- **AesCbcDecrypt** : 使用 AES CBC 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCbcDecrypt)] + [[play](https://go.dev/play/p/IOq_g8_lKZD)] +- **AesCtrCryptdeprecated** : 使用 AES CTR 算法模式加密/解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCtrCrypt)] + [[play](https://go.dev/play/p/SpaZO0-5Nsp)] +- **AesCtrEncrypt** : 使用 AES CTR 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCtrCrypt)] + [[play](https://go.dev/play/p/x6pjPAvThRz)] +- **AesCtrDecrypt** : 使用 AES CTR 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCtrCrypt)] + [[play](https://go.dev/play/p/x6pjPAvThRz)] +- **AesCfbEncrypt** : 使用 AES CFB 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCfbEncrypt)] + [[play](https://go.dev/play/p/tfkF10B13kH)] +- **AesCfbDecrypt** : 使用 AES CFB 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesCfbDecrypt)] + [[play](https://go.dev/play/p/tfkF10B13kH)] +- **AesOfbEncrypt** : 使用 AES OFB 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesOfbEncrypt)] + [[play](https://go.dev/play/p/VtHxtkUj-3F)] +- **AesOfbDecrypt** : 使用 AES OFB 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesOfbDecrypt)] + [[play](https://go.dev/play/p/VtHxtkUj-3F)] +- **AesGcmEncrypt** : 使用 AES GCM 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesGcmEncrypt)] + [[play](https://go.dev/play/p/rUt0-DmsPCs)] +- **AesGcmDecrypt** : 使用 AES GCM 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesGcmDecrypt)] + [[play](https://go.dev/play/p/rUt0-DmsPCs)] +- **Base64StdEncode** : 将字符串 base64 编码。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Base64StdEncode)] + [[play](https://go.dev/play/p/VOaUyQUreoK)] +- **Base64StdDecode** : 解码 base64 字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Base64StdDecode)] + [[play](https://go.dev/play/p/RWQylnJVgIe)] +- **DesEcbEncrypt** : 使用 DES ECB 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesEcbEncrypt)] + [[play](https://go.dev/play/p/8qivmPeZy4P)] +- **DesEcbDecrypt** : 使用 DES ECB 算法模解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesEcbDecrypt)] + [[play](https://go.dev/play/p/8qivmPeZy4P)] +- **DesCbcEncrypt** : 使用 DES CBC 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCbcEncrypt)] + [[play](https://go.dev/play/p/4cC4QvWfe3_1)] +- **DesCbcDecrypt** : 使用 DES CBC 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCbcDecrypt)] + [[play](https://go.dev/play/p/4cC4QvWfe3_1)] +- **DesCtrCryptdeprecated** : 使用 DES CTR 算法模式加密/解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCtrCrypt)] + [[play](https://go.dev/play/p/9-T6OjKpcdw)] +- **DesCtrEncrypt** : 使用 DES CTR 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCtrEncrypt)] + [[play](https://go.dev/play/p/S6p_WHCgH1d)] +- **DesCtrDecrypt** : 使用 DES CTR 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCtrDecrypt)] + [[play](https://go.dev/play/p/S6p_WHCgH1d)] +- **DesCfbEncrypt** : 使用 DES CFB 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCfbEncrypt)] + [[play](https://go.dev/play/p/y-eNxcFBlxL)] +- **DesCfbDecrypt** : 使用 DES CFB 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesCfbDecrypt)] + [[play](https://go.dev/play/p/y-eNxcFBlxL)] +- **DesOfbEncrypt** : 使用 DES OFB 算法模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesOfbEncrypt)] + [[play](https://go.dev/play/p/74KmNadjN1J)] +- **DesOfbDecrypt** : 使用 DES OFB 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#DesOfbDecrypt)] + [[play](https://go.dev/play/p/74KmNadjN1J)] +- **HmacMd5** : 返回字符串 md5 hmac 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacMd5)] + [[play](https://go.dev/play/p/uef0q1fz53I)] +- **HmacMd5WithBase64** : 获取字符串 md5 hmac base64 字符串值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacMd5WithBase64)] + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacMd5WithBase64)] +- **HmacSha1** : 返回字符串 sha1 hmac 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha1)] + [[play](https://go.dev/play/p/1UI4oQ4WXKM)] +- **HmacSha1WithBase64** : 获取字符串的 sha1 base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha1WithBase64)] + [[play](https://go.dev/play/p/47JmmGrnF7B)] +- **HmacSha256** : 返回字符串 sha256 hmac 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha256)] + [[play](https://go.dev/play/p/HhpwXxFhhC0)] +- **HmacSha256WithBase64** : 获取字符串 sha256 hmac base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha256WithBase64)] + [[play](https://go.dev/play/p/EKbkUvPTLwO)] +- **HmacSha512** : 返回字符串 sha256 hmac 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha512)] + [[play](https://go.dev/play/p/59Od6m4A0Ud)] +- **HmacSha512WithBase64** : 获取字符串 sha512 hmac base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#HmacSha512WithBase64)] + [[play](https://go.dev/play/p/c6dSe3E2ydU)] +- **Md5Byte** : 返回 byte slice 的 md5 值. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5Byte)] + [[play](https://go.dev/play/p/suraalH8lyC)] +- **Md5ByteWithBase64** : 获取 byte slice 的 md5 base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5ByteWithBase64)] + [[play](https://go.dev/play/p/Tcb-Z7LN2ax)] +- **Md5String** : 返回字符串 md5 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5String)] + [[play](https://go.dev/play/p/1bLcVetbTOI)] +- **Md5StringWithBase64** : 获取字符串 md5 base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5StringWithBase64)] + [[play](https://go.dev/play/p/Lx4gH7Vdr5_y)] +- **Md5File** : 返回文件 md5 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Md5File)] +- **Sha1** : 返回字符串 sha1 哈希值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha1)] + [[play](https://go.dev/play/p/_m_uoD1deMT)] +- **Sha1WithBase64** : 获取字符串 sha1 base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha1WithBase64)] + [[play](https://go.dev/play/p/fSyx-Gl2l2-)] +- **Sha256** :返回字符串 sha256 哈希值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha256)] + [[play](https://go.dev/play/p/tU9tfBMIAr1)] +- **Sha256WithBase64** : 获取字符串 sha256 base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha256WithBase64)] + [[play](https://go.dev/play/p/85IXJHIal1k)] +- **Sha512** : 返回字符串 sha512 哈希值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha512)] + [[play](https://go.dev/play/p/3WsvLYZxsHa)] +- **Sha512WithBase64** : 获取字符串 sha512 base64 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sha512WithBase64)] + [[play](https://go.dev/play/p/q_fY2rA-k5I)] +- **GenerateRsaKey** : 在当前目录下创建 rsa 私钥文件和公钥文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#GenerateRsaKey)] + [[play](https://go.dev/play/p/zutRHrDqs0X)] +- **RsaEncrypt** : 用公钥文件 ras 加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaEncrypt)] + [[play](https://go.dev/play/p/7_zo6mrx-eX)] +- **RsaDecrypt** : 用私钥文件 rsa 解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaDecrypt)] + [[play](https://go.dev/play/p/7_zo6mrx-eX)] +- **GenerateRsaKeyPair** : 创建 rsa 公钥私钥和 key。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#GenerateRsaKeyPair)] + [[play](https://go.dev/play/p/sSVmkfENKMz)] +- **RsaEncryptOAEP** : rsa OAEP 加密。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaEncryptOAEP)] + [[play](https://go.dev/play/p/sSVmkfENKMz)] +- **RsaDecryptOAEP** : rsa OAEP 解密。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaDecryptOAEP)] + [[play](https://go.dev/play/p/sSVmkfENKMz)] +- **RsaSign** : 应用 RSA 算法签名数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaSign)] + [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] +- **RsaVerifySign** : 验证数据的签名是否符合 RSA 算法。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#RsaVerifySign)] + [[play](https://go.dev/play/p/qhsbf8BJ6Mf)] +- **GenerateSm2Key** : 生成 SM2 公钥和私钥。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#GenerateSm2Key)] + [[play](https://go.dev/play/p/bKYMqRLvIx3)] +- **Sm2Encrypt** : 使用 SM2 公钥加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm2Encrypt)] + [[play](https://go.dev/play/p/bKYMqRLvIx3)] +- **Sm2Decrypt** : 使用 SM2 私钥解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm2Decrypt)] + [[play](https://go.dev/play/p/bKYMqRLvIx3)] +- **Sm3** : 返回数据的 SM3 哈希值(256 位)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm3)] + [[play](https://go.dev/play/p/zDAQpteAiOc)] +- **Sm4EcbEncrypt** : 使用 SM4 ECB 模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4EcbEncrypt)] + [[play](https://go.dev/play/p/l5IQxYuuaED)] +- **Sm4EcbDecrypt** : 使用 SM4 ECB 模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4EcbDecrypt)] + [[play](https://go.dev/play/p/l5IQxYuuaED)] +- **Sm4CbcEncrypt** : 使用 SM4 CBC 模式加密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4CbcEncrypt)] + [[play](https://go.dev/play/p/65Q6iYhLRTa)] +- **Sm4CbcDecrypt** : 使用 SM4 CBC 模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Sm4CbcDecrypt)] + [[play](https://go.dev/play/p/65Q6iYhLRTa)]

7. datetime日期时间处理包,格式化日期,比较日期。       回到目录

@@ -568,165 +568,165 @@ import "github.com/duke-git/lancet/v2/datetime" #### 函数列表: -- **AddDay** : 将日期加/减天数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddDay)] - [[play](https://go.dev/play/p/dIGbs_uTdFa)] -- **AddHour** : 将日期加/减小时数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddHour)] - [[play](https://go.dev/play/p/rcMjd7OCsi5)] -- **AddMinute** : 将日期加/减分钟数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddMinute)] - [[play](https://go.dev/play/p/nT1heB1KUUK)] -- **AddWeek** : 将日期加/减星期数. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddWeek)] - [[play](https://go.dev/play/p/M9TqdMiaA2p)] -- **AddMonth** : 将日期加/减月数. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddMonth)] - [[play](https://go.dev/play/p/DLoiOnpLvsN)] -- **AddYear** : 将日期加/减分年数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddYear)] - [[play](https://go.dev/play/p/MqW2ujnBx10)] -- **AddDaySafe** : 增加/减少指定的天数,并确保日期是有效日期。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddDaySafe)] - [[play](https://go.dev/play/p/JTohZFpoDJ3)] -- **AddMonthSafe** : 增加/减少指定的月份,并确保日期是有效日期。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddMonthSafe)] - [[play](https://go.dev/play/p/KLw0lo6mbVW)] -- **AddYearSafe** : 增加/减少指定的年份,并确保日期是有效日期。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddYearSafe)] - [[play](https://go.dev/play/p/KVGXWZZ54ZH)] -- **BeginOfMinute** : 返回指定时间的分钟开始时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfMinute)] - [[play](https://go.dev/play/p/ieOLVJ9CiFT)] -- **BeginOfHour** : 返回指定时间的小时开始时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfHour)] - [[play](https://go.dev/play/p/GhdGFnDWpYs)] -- **BeginOfDay** : 返回指定时间的当天开始时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfDay)] - [[play](https://go.dev/play/p/94m_UT6cWs9)] -- **BeginOfWeek** : 返回指定时间的每周开始时间,默认开始时间星期日。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfWeek)] - [[play](https://go.dev/play/p/DCHdcL6gnfV)] -- **BeginOfMonth** : 返回指定时间的当月开始时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfMonth)] - [[play](https://go.dev/play/p/bWXVFsmmzwL)] -- **BeginOfYear** : 返回指定时间的当年开始时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfYear)] - [[play](https://go.dev/play/p/i326DSwLnV8)] -- **EndOfMinute** : 返回指定时间的分钟结束时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfMinute)] - [[play](https://go.dev/play/p/yrL5wGzPj4z)] -- **EndOfHour** : 返回指定时间的小时结束时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfHour)] - [[play](https://go.dev/play/p/6ce3j_6cVqN)] -- **EndOfDay** : 返回指定时间的当天结束时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfDay)] - [[play](https://go.dev/play/p/eMBOvmq5Ih1)] -- **EndOfWeek** : 返回指定时间的星期结束时间,默认结束时间星期六。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfWeek)] - [[play](https://go.dev/play/p/mGSA162YgX9)] -- **EndOfMonth** : 返回指定时间的月份结束时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfMonth)] - [[play](https://go.dev/play/p/_GWh10B3Nqi)] -- **EndOfYear** : 返回指定时间的年份结束时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfYear)] - [[play](https://go.dev/play/p/G01cKlMCvNm)] -- **GetNowDate** : 获取当天日期,返回格式:yyyy-mm-dd。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNowDate)] - [[play](https://go.dev/play/p/PvfkPpcpBBf)] -- **GetNowTime** : 获取当时时间,返回格式:hh:mm:ss。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNowTime)] - [[play](https://go.dev/play/p/l7BNxCkTmJS)] -- **GetNowDateTime** : 获取当时日期和时间,返回格式:yyyy-mm-dd hh:mm:ss。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNowDateTime)] - [[play](https://go.dev/play/p/pI4AqngD0al)] -- **GetTodayStartTime** : 返回当天开始时间, 格式: yyyy-mm-dd 00:00:00。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetTodayStartTime)] - [[play](https://go.dev/play/p/84siyYF7t99)] -- **GetTodayEndTime** : 返回当天结束时间,格式: yyyy-mm-dd 23:59:59。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetTodayEndTime)] - [[play](https://go.dev/play/p/jjrLnfoqgn3)] -- **GetZeroHourTimestamp** : 获取零时时间戳(timestamp of 00:00)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetZeroHourTimestamp)] - [[play](https://go.dev/play/p/QmL2oIaGE3q)] -- **GetNightTimestamp** : 获取午夜时间戳(timestamp of 23:59)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNightTimestamp)] - [[play](https://go.dev/play/p/UolysR3MYP1)] -- **FormatTimeToStr** : 将日期格式化成字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#FormatTimeToStr)] - [[play](https://go.dev/play/p/_Ia7M8H_OvE)] -- **FormatStrToTime** : 将字符串格式化成时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#FormatStrToTime)] - [[play](https://go.dev/play/p/1h9FwdU8ql4)] -- **NewUnix** : 创建一个 unix 时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewUnix)] - [[play](https://go.dev/play/p/psoSuh_kLRt)] -- **NewUnixNow** : 创建一个当前时间的 unix 时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewUnixNow)] - [[play](https://go.dev/play/p/U4PPx-9D0oz)] -- **NewFormat** : 创建一个 yyyy-mm-dd hh:mm:ss 格式时间字符串的 unix 时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewFormat)] - [[play](https://go.dev/play/p/VkW08ZOaXPZ)] -- **NewISO8601** : 创建一个 iso8601 格式时间字符串的 unix 时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewISO8601)] - [[play](https://go.dev/play/p/mkhOHQkdeA2)] -- **ToUnix** : 返回 unix 时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToUnix)] - [[play](https://go.dev/play/p/_LUiwAdocjy)] -- **ToFormat** : 返回格式'yyyy-mm-dd hh:mm:ss'的日期字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToFormat)] - [[play](https://go.dev/play/p/VkW08ZOaXPZ)] -- **ToFormatForTpl** : 返回 tpl 格式指定的日期字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToFormatForTpl)] - [[play](https://go.dev/play/p/nyXxXcQJ8L5)] -- **ToIso8601** : 返回 iso8601 日期字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToIso8601)] - [[play](https://go.dev/play/p/mkhOHQkdeA2)] -- **IsLeapYear** :验证是否是闰年。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#IsLeapYear)] - [[play](https://go.dev/play/p/xS1eS2ejGew)] -- **BetweenSeconds** : 返回两个时间的间隔秒数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BetweenSeconds)] - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BetweenSeconds)] -- **DayOfYear** : 返回参数日期是一年中的第几天。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#DayOfYear)] - [[play](https://go.dev/play/p/0hjqhTwFNlH)] -- **IsWeekend** : 判断日期是否是周末。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#IsWeekend)] - [[play](https://go.dev/play/p/cupRM5aZOIY)] -- **NowDateOrTime** : 根据指定的格式和时区返回当前时间字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NowDateOrTime)] - [[play](https://go.dev/play/p/EZ-begEjtT0)] -- **Timestamp** : 返回当前秒级时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#Timestamp)] - [[play](https://go.dev/play/p/iU5b7Vvjx6x)] -- **TimestampMilli** : 返回当前毫秒级时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TimestampMilli)] - [[play](https://go.dev/play/p/4gvEusOTu1T)] -- **TimestampMicro** : 返回当前微秒级时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TimestampMicro)] - [[play](https://go.dev/play/p/2maANglKHQE)] -- **TimestampNano** : 返回当前纳秒级时间戳。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TimestampNano)] - [[play](https://go.dev/play/p/A9Oq_COrcCF)] -- **TrackFuncTime** : 测试函数执行时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TrackFuncTime)] - [[play](https://go.dev/play/p/QBSEdfXHPTp)] -- **DaysBetween** : 返回两个日期之间的天数差。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#DaysBetween)] - [[play](https://go.dev/play/p/qD6qGb3TbOy)] -- **GenerateDatetimesBetween** : 生成从 start 到 end 的所有日期时间的字符串列表。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GenerateDatetimesBetween)] - [[play](https://go.dev/play/p/6kHBpAxD9ZC)] -- **Min** : 返回最早时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#Min)] - [[play](https://go.dev/play/p/MCIDvHNOGGb)] -- **Max** : 返回最晚时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#Max)] - [[play](https://go.dev/play/p/9m6JMk1LB7-)] -- **MaxMin** : 返回最早和最晚时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#MaxMin)] - [[play](https://go.dev/play/p/rbW51cDtM_2)] +- **AddDay** : 将日期加/减天数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddDay)] + [[play](https://go.dev/play/p/dIGbs_uTdFa)] +- **AddHour** : 将日期加/减小时数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddHour)] + [[play](https://go.dev/play/p/rcMjd7OCsi5)] +- **AddMinute** : 将日期加/减分钟数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddMinute)] + [[play](https://go.dev/play/p/nT1heB1KUUK)] +- **AddWeek** : 将日期加/减星期数. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddWeek)] + [[play](https://go.dev/play/p/M9TqdMiaA2p)] +- **AddMonth** : 将日期加/减月数. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddMonth)] + [[play](https://go.dev/play/p/DLoiOnpLvsN)] +- **AddYear** : 将日期加/减分年数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddYear)] + [[play](https://go.dev/play/p/MqW2ujnBx10)] +- **AddDaySafe** : 增加/减少指定的天数,并确保日期是有效日期。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddDaySafe)] + [[play](https://go.dev/play/p/JTohZFpoDJ3)] +- **AddMonthSafe** : 增加/减少指定的月份,并确保日期是有效日期。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddMonthSafe)] + [[play](https://go.dev/play/p/KLw0lo6mbVW)] +- **AddYearSafe** : 增加/减少指定的年份,并确保日期是有效日期。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#AddYearSafe)] + [[play](https://go.dev/play/p/KVGXWZZ54ZH)] +- **BeginOfMinute** : 返回指定时间的分钟开始时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfMinute)] + [[play](https://go.dev/play/p/ieOLVJ9CiFT)] +- **BeginOfHour** : 返回指定时间的小时开始时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfHour)] + [[play](https://go.dev/play/p/GhdGFnDWpYs)] +- **BeginOfDay** : 返回指定时间的当天开始时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfDay)] + [[play](https://go.dev/play/p/94m_UT6cWs9)] +- **BeginOfWeek** : 返回指定时间的每周开始时间,默认开始时间星期日。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfWeek)] + [[play](https://go.dev/play/p/DCHdcL6gnfV)] +- **BeginOfMonth** : 返回指定时间的当月开始时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfMonth)] + [[play](https://go.dev/play/p/bWXVFsmmzwL)] +- **BeginOfYear** : 返回指定时间的当年开始时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BeginOfYear)] + [[play](https://go.dev/play/p/i326DSwLnV8)] +- **EndOfMinute** : 返回指定时间的分钟结束时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfMinute)] + [[play](https://go.dev/play/p/yrL5wGzPj4z)] +- **EndOfHour** : 返回指定时间的小时结束时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfHour)] + [[play](https://go.dev/play/p/6ce3j_6cVqN)] +- **EndOfDay** : 返回指定时间的当天结束时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfDay)] + [[play](https://go.dev/play/p/eMBOvmq5Ih1)] +- **EndOfWeek** : 返回指定时间的星期结束时间,默认结束时间星期六。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfWeek)] + [[play](https://go.dev/play/p/mGSA162YgX9)] +- **EndOfMonth** : 返回指定时间的月份结束时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfMonth)] + [[play](https://go.dev/play/p/_GWh10B3Nqi)] +- **EndOfYear** : 返回指定时间的年份结束时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#EndOfYear)] + [[play](https://go.dev/play/p/G01cKlMCvNm)] +- **GetNowDate** : 获取当天日期,返回格式:yyyy-mm-dd。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNowDate)] + [[play](https://go.dev/play/p/PvfkPpcpBBf)] +- **GetNowTime** : 获取当时时间,返回格式:hh:mm:ss。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNowTime)] + [[play](https://go.dev/play/p/l7BNxCkTmJS)] +- **GetNowDateTime** : 获取当时日期和时间,返回格式:yyyy-mm-dd hh:mm:ss。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNowDateTime)] + [[play](https://go.dev/play/p/pI4AqngD0al)] +- **GetTodayStartTime** : 返回当天开始时间, 格式: yyyy-mm-dd 00:00:00。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetTodayStartTime)] + [[play](https://go.dev/play/p/84siyYF7t99)] +- **GetTodayEndTime** : 返回当天结束时间,格式: yyyy-mm-dd 23:59:59。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetTodayEndTime)] + [[play](https://go.dev/play/p/jjrLnfoqgn3)] +- **GetZeroHourTimestamp** : 获取零时时间戳(timestamp of 00:00)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetZeroHourTimestamp)] + [[play](https://go.dev/play/p/QmL2oIaGE3q)] +- **GetNightTimestamp** : 获取午夜时间戳(timestamp of 23:59)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GetNightTimestamp)] + [[play](https://go.dev/play/p/UolysR3MYP1)] +- **FormatTimeToStr** : 将日期格式化成字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#FormatTimeToStr)] + [[play](https://go.dev/play/p/_Ia7M8H_OvE)] +- **FormatStrToTime** : 将字符串格式化成时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#FormatStrToTime)] + [[play](https://go.dev/play/p/1h9FwdU8ql4)] +- **NewUnix** : 创建一个 unix 时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewUnix)] + [[play](https://go.dev/play/p/psoSuh_kLRt)] +- **NewUnixNow** : 创建一个当前时间的 unix 时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewUnixNow)] + [[play](https://go.dev/play/p/U4PPx-9D0oz)] +- **NewFormat** : 创建一个 yyyy-mm-dd hh:mm:ss 格式时间字符串的 unix 时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewFormat)] + [[play](https://go.dev/play/p/VkW08ZOaXPZ)] +- **NewISO8601** : 创建一个 iso8601 格式时间字符串的 unix 时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NewISO8601)] + [[play](https://go.dev/play/p/mkhOHQkdeA2)] +- **ToUnix** : 返回 unix 时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToUnix)] + [[play](https://go.dev/play/p/_LUiwAdocjy)] +- **ToFormat** : 返回格式'yyyy-mm-dd hh:mm:ss'的日期字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToFormat)] + [[play](https://go.dev/play/p/VkW08ZOaXPZ)] +- **ToFormatForTpl** : 返回 tpl 格式指定的日期字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToFormatForTpl)] + [[play](https://go.dev/play/p/nyXxXcQJ8L5)] +- **ToIso8601** : 返回 iso8601 日期字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#ToIso8601)] + [[play](https://go.dev/play/p/mkhOHQkdeA2)] +- **IsLeapYear** :验证是否是闰年。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#IsLeapYear)] + [[play](https://go.dev/play/p/xS1eS2ejGew)] +- **BetweenSeconds** : 返回两个时间的间隔秒数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BetweenSeconds)] + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#BetweenSeconds)] +- **DayOfYear** : 返回参数日期是一年中的第几天。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#DayOfYear)] + [[play](https://go.dev/play/p/0hjqhTwFNlH)] +- **IsWeekend** : 判断日期是否是周末。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#IsWeekend)] + [[play](https://go.dev/play/p/cupRM5aZOIY)] +- **NowDateOrTime** : 根据指定的格式和时区返回当前时间字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#NowDateOrTime)] + [[play](https://go.dev/play/p/EZ-begEjtT0)] +- **Timestamp** : 返回当前秒级时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#Timestamp)] + [[play](https://go.dev/play/p/iU5b7Vvjx6x)] +- **TimestampMilli** : 返回当前毫秒级时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TimestampMilli)] + [[play](https://go.dev/play/p/4gvEusOTu1T)] +- **TimestampMicro** : 返回当前微秒级时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TimestampMicro)] + [[play](https://go.dev/play/p/2maANglKHQE)] +- **TimestampNano** : 返回当前纳秒级时间戳。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TimestampNano)] + [[play](https://go.dev/play/p/A9Oq_COrcCF)] +- **TrackFuncTime** : 测试函数执行时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#TrackFuncTime)] + [[play](https://go.dev/play/p/QBSEdfXHPTp)] +- **DaysBetween** : 返回两个日期之间的天数差。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#DaysBetween)] + [[play](https://go.dev/play/p/qD6qGb3TbOy)] +- **GenerateDatetimesBetween** : 生成从 start 到 end 的所有日期时间的字符串列表。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GenerateDatetimesBetween)] + [[play](https://go.dev/play/p/6kHBpAxD9ZC)] +- **Min** : 返回最早时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#Min)] + [[play](https://go.dev/play/p/MCIDvHNOGGb)] +- **Max** : 返回最晚时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#Max)] + [[play](https://go.dev/play/p/9m6JMk1LB7-)] +- **MaxMin** : 返回最早和最晚时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#MaxMin)] + [[play](https://go.dev/play/p/rbW51cDtM_2)]

8. datastructure 包含一些普通的数据结构实现。例如:list, linklist, stack, queue, set, tree, graph。       回到目录

@@ -744,24 +744,24 @@ import hashmap "github.com/duke-git/lancet/v2/datastructure/hashmap" #### 函数列表: -- **List** : 线性表结构, 用切片实现。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/list.md)] -- **CopyOnWriteList** : 是一个线程安全的 List 实现,底层使用 go 切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/copyonwritelist.md)] -- **Link** : 链表解构, 包括单链表和双向链表。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/link.md)] -- **Stack** : 栈结构(fifo), 包括数组栈和链表栈。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/stack.md)] -- **Queue** : 队列结构(filo), 包括数组队列,链表队列,循环队列,优先级队列。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/queue.md)] -- **Set** : 集合(set)结构。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/set.md)] -- **Tree** : 二叉搜索树。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/tree.md)] -- **Heap** : 二叉 max 堆。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/heap.md)] -- **Hashmap** : 哈希映射。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/hashmap.md)] +- **List** : 线性表结构, 用切片实现。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/list.md)] +- **CopyOnWriteList** : 是一个线程安全的 List 实现,底层使用 go 切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/copyonwritelist.md)] +- **Link** : 链表解构, 包括单链表和双向链表。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/link.md)] +- **Stack** : 栈结构(fifo), 包括数组栈和链表栈。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/stack.md)] +- **Queue** : 队列结构(filo), 包括数组队列,链表队列,循环队列,优先级队列。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/queue.md)] +- **Set** : 集合(set)结构。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/set.md)] +- **Tree** : 二叉搜索树。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/tree.md)] +- **Heap** : 二叉 max 堆。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/heap.md)] +- **Hashmap** : 哈希映射。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datastructure/hashmap.md)]

9. EventbBus是一个事件总线,用于在应用程序中处理事件。       回到目录

@@ -771,36 +771,36 @@ import "github.com/duke-git/lancet/v2/eventbus" #### 函数列表: -- **NewEventBus** : 创建 EventBus 实例。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#NewEventBus)] - [[play](https://go.dev/play/p/gHbOPV_NUOJ)] -- **Subscribe** : 订阅具有特定事件主题和监听函数的事件。支持异步,事件优先级,事件过滤器。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#Subscribe)] - [[play](https://go.dev/play/p/EYGf_8cHei-)] -- **Unsubscribe** : 取消订阅具有特定事件主题的事件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#Unsubscribe)] - [[play](https://go.dev/play/p/Tmh7Ttfvprf)] -- **Publish** : 发布一个带有特定事件主题和数据负载的事件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#Publish)] - [[play](https://go.dev/play/p/gHTtVexFSH9)] -- **ClearListeners** : 清空所有事件监听器。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#ClearListeners)] - [[play](https://go.dev/play/p/KBfBYlKPgqD)] -- **ClearListenersByTopic** : 清空特定事件监听器。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#ClearListenersByTopic)] - [[play](https://go.dev/play/p/gvMljmJOZmU)] -- **GetListenersCount** : 获取特定事件的监听器数量。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#GetListenersCount)] - [[play](https://go.dev/play/p/8VPJsMQgStM)] -- **GetAllListenersCount** : 获取所有事件的监听器数量。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#GetAllListenersCount)] - [[play](https://go.dev/play/p/PUlr0xcpEOz)] -- **GetEvents** : 获取所有事件的 topic。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#GetEvents)] - [[play](https://go.dev/play/p/etgjjcOtAjX)] -- **SetErrorHandler** : 设置事件的错误处理函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#SetErrorHandler)] - [[play](https://go.dev/play/p/gmB0gnFe5mc)] +- **NewEventBus** : 创建 EventBus 实例。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#NewEventBus)] + [[play](https://go.dev/play/p/gHbOPV_NUOJ)] +- **Subscribe** : 订阅具有特定事件主题和监听函数的事件。支持异步,事件优先级,事件过滤器。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#Subscribe)] + [[play](https://go.dev/play/p/EYGf_8cHei-)] +- **Unsubscribe** : 取消订阅具有特定事件主题的事件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#Unsubscribe)] + [[play](https://go.dev/play/p/Tmh7Ttfvprf)] +- **Publish** : 发布一个带有特定事件主题和数据负载的事件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#Publish)] + [[play](https://go.dev/play/p/gHTtVexFSH9)] +- **ClearListeners** : 清空所有事件监听器。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#ClearListeners)] + [[play](https://go.dev/play/p/KBfBYlKPgqD)] +- **ClearListenersByTopic** : 清空特定事件监听器。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#ClearListenersByTopic)] + [[play](https://go.dev/play/p/gvMljmJOZmU)] +- **GetListenersCount** : 获取特定事件的监听器数量。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#GetListenersCount)] + [[play](https://go.dev/play/p/8VPJsMQgStM)] +- **GetAllListenersCount** : 获取所有事件的监听器数量。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#GetAllListenersCount)] + [[play](https://go.dev/play/p/PUlr0xcpEOz)] +- **GetEvents** : 获取所有事件的 topic。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#GetEvents)] + [[play](https://go.dev/play/p/etgjjcOtAjX)] +- **SetErrorHandler** : 设置事件的错误处理函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/eventbus.md#SetErrorHandler)] + [[play](https://go.dev/play/p/gmB0gnFe5mc)]

10. Enum实现一个简单枚举工具包。.        Index

@@ -810,60 +810,60 @@ import "github.com/duke-git/lancet/v2/enum" #### Function list: -- **NewItem** : 创建枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#NewItem)] - [[play](https://go.dev/play/p/8qNsLw01HD5)] -- **NewItemsFromPairs** : 从 Pair 结构体的切片创建枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#NewItemsFromPairs)] - [[play](https://go.dev/play/p/xKnoGa7gnev)] -- **Value** : 返回枚举项的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Value)] - [[play](https://go.dev/play/p/xKnoGa7gnev)] -- **Name** : 返回枚举项的名称。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Name)] - [[play](https://go.dev/play/p/xKnoGa7gnev)] -- **Valid** : 检查枚举项是否有效。如果提供了自定义检查函数,将使用该函数验证值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Valid)] - [[play](https://go.dev/play/p/pA3lYY2VSm3)] -- **MarshalJSON** : 枚举项实现 json.Marshaler 接口。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#MarshalJSON)] - [[play](https://go.dev/play/p/zIZEdAnneB5)] -- **NewRegistry** : Registry 定义了一个通用的枚举注册表结构体。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#NewRegistry)] - [[play](https://go.dev/play/p/ABEXsYfJKMo)] -- **Add** : 向枚举注册表添加枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Add)] - [[play](https://go.dev/play/p/ABEXsYfJKMo)] -- **Remove** : 在枚举注册表中删除枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Remove)] - [[play](https://go.dev/play/p/dSG84wQ3TuC)] -- **Update** : 在枚举注册表中更新枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Update)] - [[play](https://go.dev/play/p/Ol0moT1J9Xl)] -- **GetByValue** : 在枚举注册表中通过值获取枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#GetByValue)] - [[play](https://go.dev/play/p/niJ1U2KlE_m)] -- **GetByName** : 在枚举注册表中通过名称获取枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#GetByName)] - [[play](https://go.dev/play/p/49ie_gpqH0m)] -- **Items** : 返回枚举注册表中的枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Items)] - [[play](https://go.dev/play/p/lAJFAradbvQ)] -- **Contains** : 检查注册表中是否存在具有给定值的枚举项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Contains)] - [[play](https://go.dev/play/p/_T-lPYkZn2j)] -- **Size** : 返回注册表中枚举项的数目。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Size)] - [[play](https://go.dev/play/p/TeDArWhlQe2)] -- **Range** : 遍历注册表中的所有枚举项,并应用给定的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Range)] - [[play](https://go.dev/play/p/GPsZbQbefWN)] -- **SortedItems** : 返回按给定比较函数排序的所有枚举项的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#SortedItems)] - [[play](https://go.dev/play/p/tN9RE_m_WEI)] -- **Filter** : 返回满足给定谓词函数的枚举项切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Filter)] - [[play](https://go.dev/play/p/uTUpTdcyoCU)] +- **NewItem** : 创建枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#NewItem)] + [[play](https://go.dev/play/p/8qNsLw01HD5)] +- **NewItemsFromPairs** : 从 Pair 结构体的切片创建枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#NewItemsFromPairs)] + [[play](https://go.dev/play/p/xKnoGa7gnev)] +- **Value** : 返回枚举项的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Value)] + [[play](https://go.dev/play/p/xKnoGa7gnev)] +- **Name** : 返回枚举项的名称。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Name)] + [[play](https://go.dev/play/p/xKnoGa7gnev)] +- **Valid** : 检查枚举项是否有效。如果提供了自定义检查函数,将使用该函数验证值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Valid)] + [[play](https://go.dev/play/p/pA3lYY2VSm3)] +- **MarshalJSON** : 枚举项实现 json.Marshaler 接口。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#MarshalJSON)] + [[play](https://go.dev/play/p/zIZEdAnneB5)] +- **NewRegistry** : Registry 定义了一个通用的枚举注册表结构体。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#NewRegistry)] + [[play](https://go.dev/play/p/ABEXsYfJKMo)] +- **Add** : 向枚举注册表添加枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Add)] + [[play](https://go.dev/play/p/ABEXsYfJKMo)] +- **Remove** : 在枚举注册表中删除枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Remove)] + [[play](https://go.dev/play/p/dSG84wQ3TuC)] +- **Update** : 在枚举注册表中更新枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Update)] + [[play](https://go.dev/play/p/Ol0moT1J9Xl)] +- **GetByValue** : 在枚举注册表中通过值获取枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#GetByValue)] + [[play](https://go.dev/play/p/niJ1U2KlE_m)] +- **GetByName** : 在枚举注册表中通过名称获取枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#GetByName)] + [[play](https://go.dev/play/p/49ie_gpqH0m)] +- **Items** : 返回枚举注册表中的枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Items)] + [[play](https://go.dev/play/p/lAJFAradbvQ)] +- **Contains** : 检查注册表中是否存在具有给定值的枚举项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Contains)] + [[play](https://go.dev/play/p/_T-lPYkZn2j)] +- **Size** : 返回注册表中枚举项的数目。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Size)] + [[play](https://go.dev/play/p/TeDArWhlQe2)] +- **Range** : 遍历注册表中的所有枚举项,并应用给定的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Range)] + [[play](https://go.dev/play/p/GPsZbQbefWN)] +- **SortedItems** : 返回按给定比较函数排序的所有枚举项的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#SortedItems)] + [[play](https://go.dev/play/p/tN9RE_m_WEI)] +- **Filter** : 返回满足给定谓词函数的枚举项切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/enum.md#Filter)] + [[play](https://go.dev/play/p/uTUpTdcyoCU)]

11. fileutil 包含文件基本操作。       回到目录

@@ -873,99 +873,99 @@ import "github.com/duke-git/lancet/v2/fileutil" #### 函数列表: -- **ClearFile** : 清空文件内容。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ClearFile)] - [[play](https://go.dev/play/p/NRZ0ZT-G94H)] -- **CreateFile** : 创建文件,创建成功返回 true, 否则返回 false。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CreateFile)] - [[play](https://go.dev/play/p/lDt8PEsTNKI)] -- **CreateDir** : 创建嵌套目录,例如/a/, /a/b/。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CreateDir)] - [[play](https://go.dev/play/p/qUuCe1OGQnM)] -- **CopyFile** : 拷贝文件,会覆盖原有的文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CopyFile)] - [[play](https://go.dev/play/p/Jg9AMJMLrJi)] -- **CopyDir** : 拷贝目录。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CopyDir)] - [[play](https://go.dev/play/p/YAyFTA_UuPb)] -- **FileMode** : 获取文件 mode 信息。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#FileMode)] - [[play](https://go.dev/play/p/2l2hI42fA3p)] -- **MiMeType** : 获取文件 mime 类型, 参数的类型必须是 string 或者\*os.File。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#MiMeType)] - [[play](https://go.dev/play/p/bd5sevSUZNu)] -- **IsExist** : 判断文件或目录是否存在。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsExist)] - [[play](https://go.dev/play/p/nKKXt8ZQbmh)] -- **IsLink** : 判断文件是否是符号链接。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsLink)] - [[play](https://go.dev/play/p/TL-b-Kzvf44)] -- **IsDir** : 判断参数是否是目录。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsDir)] - [[play](https://go.dev/play/p/WkVwEKqtOWk)] -- **ListFileNames** : 返回目录下所有文件名。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ListFileNames)] - [[play](https://go.dev/play/p/Tjd7Y07rejl)] -- **RemoveFile** : 删除文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#RemoveFile)] - [[play](https://go.dev/play/p/P2y0XW8a1SH)] -- **RemoveDir** : 删除目录,支持传入删除前的回调函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#RemoveDir)] - [[play](https://go.dev/play/p/Oa6KnPek2uy)] -- **ReadFileToString** : 读取文件内容并返回字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadFileToString)] - [[play](https://go.dev/play/p/cmfwp_5SQTp)] -- **ReadFileByLine** : 按行读取文件内容,返回字符串切片包含每一行。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadFileByLine)] - [[play](https://go.dev/play/p/svJP_7ZrBrD)] -- **Zip** : zip 压缩文件, 参数可以是文件或目录。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#Zip)] - [[play](https://go.dev/play/p/j-3sWBp8ik_P)] -- **ZipAppendEntry** : 通过将单个文件或目录追加到现有的 zip 文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ZipAppendEntry)] -- **UnZip** : zip 解压缩文件并保存在目录中。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#UnZip)] - [[play](https://go.dev/play/p/g0w34kS7B8m)] -- **CurrentPath** : 返回当前位置的绝对路径。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CurrentPath)] - [[play](https://go.dev/play/p/s74a9iBGcSw)] -- **IsZipFile** : 判断文件是否是 zip 压缩文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsZipFile)] - [[play](https://go.dev/play/p/9M0g2j_uF_e)] -- **FileSize** : 返回文件字节大小。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#FileSize)] - [[play](https://go.dev/play/p/H9Z05uD-Jjc)] -- **MTime** : 返回文件修改时间(unix timestamp)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#MTime)] - [[play](https://go.dev/play/p/s_Tl7lZoAaY)] -- **Sha** : 返回文件 sha 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#Sha)] - [[play](https://go.dev/play/p/VfEEcO2MJYf)] -- **ReadCsvFile** : 读取 csv 文件内容到切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadCsvFile)] - [[play](https://go.dev/play/p/OExTkhGEd3_u)] -- **WriteCsvFile** : 向 csv 文件写入切片数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteCsvFile)] -- **WriteMapsToCsv** : 将 map 切片写入 csv 文件中。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteMapsToCsv)] - [[play](https://go.dev/play/p/umAIomZFV1c)] -- **WriteBytesToFile** : 将 bytes 写入文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteBytesToFile)] - [[play](https://go.dev/play/p/s7QlDxMj3P8)] -- **WriteStringToFile** : 将字符串写入文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteStringToFile)] - [[play](https://go.dev/play/p/GhLS6d8lH_g)] -- **ReadFile** : 读取文件或者 URL。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadFile)] -- **ChunkRead** : 从文件的指定偏移读取块并返回块内所有行。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ChunkRead)] - [[play](https://go.dev/play/p/r0hPmKWhsgf)] -- **ParallelChunkRead** : 并行读取文件并将每个块的行发送到指定通道。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ParallelChunkRead)] - [[play](https://go.dev/play/p/teMXnCsdSEw)] -- **GetExeOrDllVersion** : 返回 exe,dll 文件版本号(仅 Window 平台)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#GetExeOrDllVersion)] - [[play](https://go.dev/play/p/iLRrDBhE38E)] +- **ClearFile** : 清空文件内容。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ClearFile)] + [[play](https://go.dev/play/p/NRZ0ZT-G94H)] +- **CreateFile** : 创建文件,创建成功返回 true, 否则返回 false。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CreateFile)] + [[play](https://go.dev/play/p/lDt8PEsTNKI)] +- **CreateDir** : 创建嵌套目录,例如/a/, /a/b/。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CreateDir)] + [[play](https://go.dev/play/p/qUuCe1OGQnM)] +- **CopyFile** : 拷贝文件,会覆盖原有的文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CopyFile)] + [[play](https://go.dev/play/p/Jg9AMJMLrJi)] +- **CopyDir** : 拷贝目录。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CopyDir)] + [[play](https://go.dev/play/p/YAyFTA_UuPb)] +- **FileMode** : 获取文件 mode 信息。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#FileMode)] + [[play](https://go.dev/play/p/2l2hI42fA3p)] +- **MiMeType** : 获取文件 mime 类型, 参数的类型必须是 string 或者\*os.File。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#MiMeType)] + [[play](https://go.dev/play/p/bd5sevSUZNu)] +- **IsExist** : 判断文件或目录是否存在。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsExist)] + [[play](https://go.dev/play/p/nKKXt8ZQbmh)] +- **IsLink** : 判断文件是否是符号链接。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsLink)] + [[play](https://go.dev/play/p/TL-b-Kzvf44)] +- **IsDir** : 判断参数是否是目录。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsDir)] + [[play](https://go.dev/play/p/WkVwEKqtOWk)] +- **ListFileNames** : 返回目录下所有文件名。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ListFileNames)] + [[play](https://go.dev/play/p/Tjd7Y07rejl)] +- **RemoveFile** : 删除文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#RemoveFile)] + [[play](https://go.dev/play/p/P2y0XW8a1SH)] +- **RemoveDir** : 删除目录,支持传入删除前的回调函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#RemoveDir)] + [[play](https://go.dev/play/p/Oa6KnPek2uy)] +- **ReadFileToString** : 读取文件内容并返回字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadFileToString)] + [[play](https://go.dev/play/p/cmfwp_5SQTp)] +- **ReadFileByLine** : 按行读取文件内容,返回字符串切片包含每一行。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadFileByLine)] + [[play](https://go.dev/play/p/svJP_7ZrBrD)] +- **Zip** : zip 压缩文件, 参数可以是文件或目录。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#Zip)] + [[play](https://go.dev/play/p/j-3sWBp8ik_P)] +- **ZipAppendEntry** : 通过将单个文件或目录追加到现有的 zip 文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ZipAppendEntry)] +- **UnZip** : zip 解压缩文件并保存在目录中。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#UnZip)] + [[play](https://go.dev/play/p/g0w34kS7B8m)] +- **CurrentPath** : 返回当前位置的绝对路径。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#CurrentPath)] + [[play](https://go.dev/play/p/s74a9iBGcSw)] +- **IsZipFile** : 判断文件是否是 zip 压缩文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#IsZipFile)] + [[play](https://go.dev/play/p/9M0g2j_uF_e)] +- **FileSize** : 返回文件字节大小。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#FileSize)] + [[play](https://go.dev/play/p/H9Z05uD-Jjc)] +- **MTime** : 返回文件修改时间(unix timestamp)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#MTime)] + [[play](https://go.dev/play/p/s_Tl7lZoAaY)] +- **Sha** : 返回文件 sha 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#Sha)] + [[play](https://go.dev/play/p/VfEEcO2MJYf)] +- **ReadCsvFile** : 读取 csv 文件内容到切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadCsvFile)] + [[play](https://go.dev/play/p/OExTkhGEd3_u)] +- **WriteCsvFile** : 向 csv 文件写入切片数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteCsvFile)] +- **WriteMapsToCsv** : 将 map 切片写入 csv 文件中。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteMapsToCsv)] + [[play](https://go.dev/play/p/umAIomZFV1c)] +- **WriteBytesToFile** : 将 bytes 写入文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteBytesToFile)] + [[play](https://go.dev/play/p/s7QlDxMj3P8)] +- **WriteStringToFile** : 将字符串写入文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#WriteStringToFile)] + [[play](https://go.dev/play/p/GhLS6d8lH_g)] +- **ReadFile** : 读取文件或者 URL。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ReadFile)] +- **ChunkRead** : 从文件的指定偏移读取块并返回块内所有行。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ChunkRead)] + [[play](https://go.dev/play/p/r0hPmKWhsgf)] +- **ParallelChunkRead** : 并行读取文件并将每个块的行发送到指定通道。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#ParallelChunkRead)] + [[play](https://go.dev/play/p/teMXnCsdSEw)] +- **GetExeOrDllVersion** : 返回 exe,dll 文件版本号(仅 Window 平台)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/fileutil.md#GetExeOrDllVersion)] + [[play](https://go.dev/play/p/iLRrDBhE38E)]

12. formatter 格式化器包含一些数据格式化处理方法。       回到目录

@@ -975,33 +975,33 @@ import "github.com/duke-git/lancet/v2/formatter" #### 函数列表: -- **Comma** : 用逗号每隔 3 位分割数字/字符串,支持添加前缀符号。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#Comma)] - [[play](https://go.dev/play/p/eRD5k2vzUVX)] -- **Pretty** : 返回 pretty JSON 字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#Pretty)] - [[play](https://go.dev/play/p/YsciGj3FH2x)] -- **PrettyToWriter** : Pretty encode 数据到 writer。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#PrettyToWriter)] - [[play](https://go.dev/play/p/LPLZ3lDi5ma)] -- **DecimalBytes** : 返回十进制标准(以 1000 为基数)下的可读字节单位字符串。precision 参数指定小数点后的位数,默认为 4。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#DecimalBytes)] - [[play](https://go.dev/play/p/FPXs1suwRcs)] -- **BinaryBytes** : 返回 binary 标准(以 1024 为基数)下的可读字节单位字符串。precision 参数指定小数点后的位数,默认为 4。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#BinaryBytes)] - [[play](https://go.dev/play/p/G9oHHMCAZxP)] -- **ParseDecimalBytes** : 将字节单位字符串转换成其所表示的字节数(以 1000 为基数)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParseDecimalBytes)] - [[play](https://go.dev/play/p/Am98ybWjvjj)] -- **ParseBinaryBytes** : 将字节单位字符串转换成其所表示的字节数(以 1024 为基数)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParseBinaryBytes)] - [[play](https://go.dev/play/p/69v1tTT62x8)] -- **ParseCNAddress** : 智能解析中国地址字符串并提取结构化信息(省、市、区、街道、姓名、电话等)。支持多种地址格式,包括县级市。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParseCNAddress)] - [[play](https://go.dev/play/p/o5l09hQopEV)] -- **ParsePersonInfo** : 从地址字符串中提取用户信息(姓名、电话、身份证、邮编)并将其与位置地址分离。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParsePersonInfo)] - [[play](https://go.dev/play/p/JO-uTlJlTy7)] +- **Comma** : 用逗号每隔 3 位分割数字/字符串,支持添加前缀符号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#Comma)] + [[play](https://go.dev/play/p/eRD5k2vzUVX)] +- **Pretty** : 返回 pretty JSON 字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#Pretty)] + [[play](https://go.dev/play/p/YsciGj3FH2x)] +- **PrettyToWriter** : Pretty encode 数据到 writer。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#PrettyToWriter)] + [[play](https://go.dev/play/p/LPLZ3lDi5ma)] +- **DecimalBytes** : 返回十进制标准(以 1000 为基数)下的可读字节单位字符串。precision 参数指定小数点后的位数,默认为 4。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#DecimalBytes)] + [[play](https://go.dev/play/p/FPXs1suwRcs)] +- **BinaryBytes** : 返回 binary 标准(以 1024 为基数)下的可读字节单位字符串。precision 参数指定小数点后的位数,默认为 4。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#BinaryBytes)] + [[play](https://go.dev/play/p/G9oHHMCAZxP)] +- **ParseDecimalBytes** : 将字节单位字符串转换成其所表示的字节数(以 1000 为基数)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParseDecimalBytes)] + [[play](https://go.dev/play/p/Am98ybWjvjj)] +- **ParseBinaryBytes** : 将字节单位字符串转换成其所表示的字节数(以 1024 为基数)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParseBinaryBytes)] + [[play](https://go.dev/play/p/69v1tTT62x8)] +- **ParseCNAddress** : 智能解析中国地址字符串并提取结构化信息(省、市、区、街道、姓名、电话等)。支持多种地址格式,包括县级市。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParseCNAddress)] + [[play](https://go.dev/play/p/o5l09hQopEV)] +- **ParsePersonInfo** : 从地址字符串中提取用户信息(姓名、电话、身份证、邮编)并将其与位置地址分离。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/formatter.md#ParsePersonInfo)] + [[play](https://go.dev/play/p/JO-uTlJlTy7)]

13. function 函数包控制函数执行流程,包含部分函数式编程。       回到目录

@@ -1011,60 +1011,60 @@ import "github.com/duke-git/lancet/v2/function" #### 函数列表: -- **After** : 创建一个函数,当该函数被调用 n 或更多次之后将执行传入的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#After)] - [[play](https://go.dev/play/p/eRD5k2vzUVX)] -- **Before** : 创建一个函数,当该函数被调用不超过 n 次时,将执行执行传入的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Before)] - [[play](https://go.dev/play/p/0HqUDIFZ3IL)] -- **CurryFn** : 创建柯里化函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#CurryFn)] - [[play](https://go.dev/play/p/5HopfDwANKX)] -- **Compose** : 从右至左组合函数列表 fnList,返回组合后的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Compose)] - [[play](https://go.dev/play/p/KKfugD4PKYF)] -- **Delay** : 延迟 delay 时间后调用函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Delay)] - [[play](https://go.dev/play/p/Ivtc2ZE-Tye)] -- **Debounceddeprecated** : 创建一个 debounced 函数,该函数延迟调用 fn 直到自上次调用 debounced 函数后等待持续时间过去。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Debounced)] - [[play](https://go.dev/play/p/absuEGB_GN7)] -- **Debounce** : 创建一个函数的去抖动版本。该去抖动函数仅在上次调用后的指定延迟时间过去之后才会调用原始函数。支持取消去抖动。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Debounce)] - [[play](https://go.dev/play/p/-dGFrYn_1Zi)] -- **Throttle** : 创建一个函数的节流版本。返回的函数保证在每个时间间隔内最多只会被调用一次。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Throttle)] - [[play](https://go.dev/play/p/HpoMov-tJSN)] -- **Schedule** : 每次持续时间调用函数,直到关闭返回的 channel。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Schedule)] - [[play](https://go.dev/play/p/hbON-Xeyn5N)] -- **Pipeline** : 从右至左执行函数列表。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Pipeline)] - [[play](https://go.dev/play/p/mPdUVvj6HD6)] -- **AcceptIf** : AcceptIf 函数会返回另一个函数,该函数的签名与 apply 函数相同,但同时还会包含一个布尔值来表示成功或失败。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#AcceptIf)] - [[play](https://go.dev/play/p/XlXHHtzCf7d)] -- **And** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑 and 操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#And)] - [[play](https://go.dev/play/p/dTBHJMQ0zD2)] -- **Or** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑 or 操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Or)] - [[play](https://go.dev/play/p/LitCIsDFNDA)] -- **Negate** : 返回一个谓词函数,该谓词函数表示当前谓词的逻辑否定。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Negate)] - [[play](https://go.dev/play/p/jbI8BtgFnVE)] -- **Nor** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑非或 nor 的操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Nor)] - [[play](https://go.dev/play/p/2KdCoBEOq84)] -- **Nand** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑非与 nand 的操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Nand)] - [[play](https://go.dev/play/p/Rb-FdNGpgSO)] -- **Xnor** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑异或 xnor 的操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Xnor)] - [[play](https://go.dev/play/p/FJxko8SFbqc)] -- **Watcher** : Watcher 用于记录代码执行时间。可以启动/停止/重置手表定时器。获取函数执行的时间。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Watcher)] - [[play](https://go.dev/play/p/l2yrOpCLd1I)] +- **After** : 创建一个函数,当该函数被调用 n 或更多次之后将执行传入的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#After)] + [[play](https://go.dev/play/p/eRD5k2vzUVX)] +- **Before** : 创建一个函数,当该函数被调用不超过 n 次时,将执行执行传入的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Before)] + [[play](https://go.dev/play/p/0HqUDIFZ3IL)] +- **CurryFn** : 创建柯里化函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#CurryFn)] + [[play](https://go.dev/play/p/5HopfDwANKX)] +- **Compose** : 从右至左组合函数列表 fnList,返回组合后的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Compose)] + [[play](https://go.dev/play/p/KKfugD4PKYF)] +- **Delay** : 延迟 delay 时间后调用函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Delay)] + [[play](https://go.dev/play/p/Ivtc2ZE-Tye)] +- **Debounceddeprecated** : 创建一个 debounced 函数,该函数延迟调用 fn 直到自上次调用 debounced 函数后等待持续时间过去。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Debounced)] + [[play](https://go.dev/play/p/absuEGB_GN7)] +- **Debounce** : 创建一个函数的去抖动版本。该去抖动函数仅在上次调用后的指定延迟时间过去之后才会调用原始函数。支持取消去抖动。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Debounce)] + [[play](https://go.dev/play/p/-dGFrYn_1Zi)] +- **Throttle** : 创建一个函数的节流版本。返回的函数保证在每个时间间隔内最多只会被调用一次。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Throttle)] + [[play](https://go.dev/play/p/HpoMov-tJSN)] +- **Schedule** : 每次持续时间调用函数,直到关闭返回的 channel。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Schedule)] + [[play](https://go.dev/play/p/hbON-Xeyn5N)] +- **Pipeline** : 从右至左执行函数列表。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Pipeline)] + [[play](https://go.dev/play/p/mPdUVvj6HD6)] +- **AcceptIf** : AcceptIf 函数会返回另一个函数,该函数的签名与 apply 函数相同,但同时还会包含一个布尔值来表示成功或失败。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#AcceptIf)] + [[play](https://go.dev/play/p/XlXHHtzCf7d)] +- **And** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑 and 操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#And)] + [[play](https://go.dev/play/p/dTBHJMQ0zD2)] +- **Or** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑 or 操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Or)] + [[play](https://go.dev/play/p/LitCIsDFNDA)] +- **Negate** : 返回一个谓词函数,该谓词函数表示当前谓词的逻辑否定。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Negate)] + [[play](https://go.dev/play/p/jbI8BtgFnVE)] +- **Nor** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑非或 nor 的操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Nor)] + [[play](https://go.dev/play/p/2KdCoBEOq84)] +- **Nand** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑非与 nand 的操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Nand)] + [[play](https://go.dev/play/p/Rb-FdNGpgSO)] +- **Xnor** : 返回一个复合谓词判断函数,该判断函数表示一组谓词的逻辑异或 xnor 的操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Xnor)] + [[play](https://go.dev/play/p/FJxko8SFbqc)] +- **Watcher** : Watcher 用于记录代码执行时间。可以启动/停止/重置手表定时器。获取函数执行的时间。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Watcher)] + [[play](https://go.dev/play/p/l2yrOpCLd1I)]

14. maputil 包括一些操作 map 的函数。       回到目录

@@ -1074,174 +1074,174 @@ import "github.com/duke-git/lancet/v2/maputil" #### 函数列表: -- **MapTo** : 快速将 map 或者其他类型映射到结构体或者指定类型。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapTo)] - [[play](https://go.dev/play/p/4K7KBEPgS5M)] -- **ForEach** : 对 map 中的每对 key 和 value 执行 iteratee 函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ForEach)] - [[play](https://go.dev/play/p/OaThj6iNVXK)] -- **Filter** : 迭代 map 中的每对 key 和 value,返回 map,其中的 key 和 value 符合 predicate 函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Filter)] - [[play](https://go.dev/play/p/fSvF3wxuNG7)] -- **FilterByKeys** : 迭代 map, 返回一个新 map,其 key 都是给定的 key 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#FilterByKeys)] - [[play](https://go.dev/play/p/7ov6BJHbVqh)] -- **FilterByValues** : 迭代 map, 返回一个新 map,其 value 都是给定的 value 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#FilterByValues)] - [[play](https://go.dev/play/p/P3-9MdcXegR)] -- **OmitBy** : Filter 的反向操作, 迭代 map 中的每对 key 和 value, 删除符合 predicate 函数的 key, value, 返回新 map。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#OmitBy)] - [[play](https://go.dev/play/p/YJM4Hj5hNwm)] -- **OmitByKeys** : FilterByKeys 的反向操作, 迭代 map, 返回一个新 map,其 key 不包括给定的 key 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#OmitByKeys)] - [[play](https://go.dev/play/p/jXGrWDBfSRp)] -- **OmitByValues** : FilterByValues 的反向操作, 迭代 map, 返回一个新 map,其 value 不包括给定的 value 值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#OmitByValues)] - [[play](https://go.dev/play/p/XB7Y10uw20_U)] -- **Intersect** : 多个 map 的交集操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Intersect)] - [[play](https://go.dev/play/p/Zld0oj3sjcC)] -- **Keys** : 返回 map 中所有 key 组成的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Keys)] - [[play](https://go.dev/play/p/xNB5bTb97Wd)] -- **KeysBy** : 创建一个切片,其元素是每个 map 的 key 调用 mapper 函数的结果。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#KeysBy)] - [[play](https://go.dev/play/p/hI371iB8Up8)] -- **Merge** : 合并多个 map, 相同的 key 会被之后的 key 覆盖。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Merge)] - [[play](https://go.dev/play/p/H95LENF1uB-)] -- **Minus** : 返回一个 map,其中的 key 存在于 mapA,不存在于 mapB。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Minus)] - [[play](https://go.dev/play/p/3u5U9K7YZ9m)] -- **Values** : 返回 map 中所有 values 组成的切片 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Values)] - [[play](https://go.dev/play/p/CBKdUc5FTW6)] -- **ValuesBy** : 创建一个切片,其元素是每个 map 的 value 调用 mapper 函数的结果。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ValuesBy)] - [[play](https://go.dev/play/p/sg9-oRidh8f)] -- **MapKeys** : 操作 map 的每个 key,然后转为新的 map。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapKeys)] - [[play](https://go.dev/play/p/8scDxWeBDKd)] -- **MapValues** : 操作 map 的每个 value,然后转为新的 map。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapValues)] - [[play](https://go.dev/play/p/g92aY3fc7Iw)] -- **Entries** : 将 map 转换为键/值对切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Entries)] - [[play](https://go.dev/play/p/Ltb11LNcElY)] -- **FromEntries** : 基于键/值对的切片创建 map。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#FromEntries)] - [[play](https://go.dev/play/p/fTdu4sCNjQO)] -- **Transform** : 将 map 转换为其他类型的 map。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Transform)] - [[play](https://go.dev/play/p/P6ovfToM3zj)] -- **IsDisjoint** : 验证两个 map 是否具有不同的 key。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#IsDisjoint)] - [[play](https://go.dev/play/p/N9qgYg_Ho6f)] -- **HasKey** : 检查 map 是否包含某个 key。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#HasKey)] - [[play](https://go.dev/play/p/isZZHOsDhFc)] -- **GetOrSet** : 返回给定键的值,如果不存在则设置该值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#GetOrSet)] - [[play](https://go.dev/play/p/IVQwO1OkEJC)] -- **MapToStruct** : 将 map 转成 struct。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapToStruct)] - [[play](https://go.dev/play/p/7wYyVfX38Dp)] -- **ToSortedSlicesDefault** : 将 map 的 key 和 value 转化成两个根据 key 的值从小到大排序的切片,value 切片中元素的位置与 key 对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ToSortedSlicesDefault)] - [[play](https://go.dev/play/p/43gEM2po-qy)] -- **ToSortedSlicesWithComparator** : 将 map 的 key 和 value 转化成两个使用比较器函数根据 key 的值自定义排序规则的切片,value 切片中元素的位置与 key 对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ToSortedSlicesWithComparator)] - [[play](https://go.dev/play/p/0nlPo6YLdt3)] -- **NewOrderedMap** : 创建有序映射。有序映射是键值对的集合,其中键是唯一的,并且保留键插入的顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#NewOrderedMap)] - [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] -- **OrderedMap_Set** : 设置给定的键值对。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Set)] - [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] -- **OrderedMap_Get** : 返回给定键的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Get)] - [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] -- **OrderedMap_Delete** : 删除给定键的键值对。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Delete)] - [[play](ttps://go.dev/play/p/5bIi4yaZ3K-)] -- **OrderedMap_Clear** : 清空 map 数据。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Clear)] - [[play](https://go.dev/play/p/8LwoJyEfuFr)] -- **OrderedMap_Front** : 返回第一个键值对。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Front)] - [[play](https://go.dev/play/p/ty57XSimpoe)] -- **OrderedMap_Back** : 返回最后一个键值对。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Back)] - [[play](https://go.dev/play/p/rQMjp1yQmpa)] -- **OrderedMap_Range** : 为每个键值对调用给定的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Range)] - [[play](https://go.dev/play/p/U-KpORhc7LZ)] -- **OrderedMap_Keys** : 按顺序返回键的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Keys)] - [[play](https://go.dev/play/p/Vv_y9ExKclA)] -- **OrderedMap_Values** : 按顺序返回值的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Values)] - [[play](https://go.dev/play/p/TWj5n1-PUfx)] -- **OrderedMap_Elements** : 按顺序返回键值对。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Elements)] - [[play](https://go.dev/play/p/4BHG4kKz6bB)] -- **OrderedMap_Len** : 返回键值对的数量。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Len)] - [[play](https://go.dev/play/p/cLe6z2VX5N-)] -- **OrderedMap_Contains** : 如果给定的键存在则返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Contains)] - [[play](https://go.dev/play/p/QuwqqnzwDNX)] -- **OrderedMap_Iter** : 返回按顺序产生键值对的通道。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Iter)] - [[play](https://go.dev/play/p/tlq2tdvicPt)] -- **OrderedMap_ReverseIter** : 返回以相反顺序产生键值对的通道。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_ReverseIter)] - [[play](https://go.dev/play/p/8Q0ssg6hZzO)] -- **OrderedMap_SortByKey** : 使用传入的比较函数排序 map key。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_SortByKey)] - [[play](https://go.dev/play/p/N7hjD_alZPq)] -- **OrderedMap_MarshalJSON** : 实现 json.Marshaler 接口。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_MarshalJSON)] - [[play](https://go.dev/play/p/C-wAwydIAC7)] -- **OrderedMap_UnmarshalJSON** : 实现 json.Unmarshaler 接口。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_UnmarshalJSON)] - [[play](https://go.dev/play/p/8C3MvJ3-mut)] -- **NewConcurrentMap** : ConcurrentMap 协程安全的 map 结构。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#NewConcurrentMap)] - [[play](https://go.dev/play/p/3PenTPETJT0)] -- **ConcurrentMap_Set** : 在 map 中设置 key 和 value。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Set)] - [[play](https://go.dev/play/p/3PenTPETJT0)] -- **ConcurrentMap_Get** : 根据 key 获取 value, 如果不存在 key,返回零值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Get)] - [[play](https://go.dev/play/p/3PenTPETJT0)] -- **ConcurrentMap_GetOrSet** : 返回键的现有值(如果存在),否则,设置 key 并返回给定值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_GetOrSet)] - [[play](https://go.dev/play/p/aDcDApOK01a)] -- **ConcurrentMap_Delete** : 删除 key。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Delete)] - [[play](https://go.dev/play/p/uTIJZYhpVMS)] -- **ConcurrentMap_GetAndDelete** :获取 key,然后删除。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_GetAndDelete)] - [[play](https://go.dev/play/p/ZyxeIXSZUiM)] -- **ConcurrentMap_Has** : 验证是否包含 key。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Has)] - [[play](https://go.dev/play/p/C8L4ul9TVwf)] -- **ConcurrentMap_Range** : 为 map 中每个键和值顺序调用迭代器。 如果 iterator 返回 false,则停止迭代。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Range)] - [[play](https://go.dev/play/p/iqcy7P8P0Pr)] -- **SortByKey** : 对传入的 map 根据 key 进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#SortByKey)] - [[play](https://go.dev/play/p/PVdmBSnm6P_W)] -- **GetOrDefault** : 返回给定键的值,如果键不存在,则返回默认值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#GetOrDefault)] - [[play](https://go.dev/play/p/99QjSYSBdiM)] -- **FindValuesBy** : 返回一个切片,包含满足给定谓词判断函数的 map 中的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#FindValuesBy)] - [[play](https://go.dev/play/p/bvNwNBZDm6v)] -- **ToMarkdownTable** : 将一个 map 切片数据转换为 Markdown 表格字符串。支持自定义表头显示名称和列的显示顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ToMarkdownTable)] - [[play](https://go.dev/play/p/w_pSLfeyEB5)] +- **MapTo** : 快速将 map 或者其他类型映射到结构体或者指定类型。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapTo)] + [[play](https://go.dev/play/p/4K7KBEPgS5M)] +- **ForEach** : 对 map 中的每对 key 和 value 执行 iteratee 函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ForEach)] + [[play](https://go.dev/play/p/OaThj6iNVXK)] +- **Filter** : 迭代 map 中的每对 key 和 value,返回 map,其中的 key 和 value 符合 predicate 函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Filter)] + [[play](https://go.dev/play/p/fSvF3wxuNG7)] +- **FilterByKeys** : 迭代 map, 返回一个新 map,其 key 都是给定的 key 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#FilterByKeys)] + [[play](https://go.dev/play/p/7ov6BJHbVqh)] +- **FilterByValues** : 迭代 map, 返回一个新 map,其 value 都是给定的 value 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#FilterByValues)] + [[play](https://go.dev/play/p/P3-9MdcXegR)] +- **OmitBy** : Filter 的反向操作, 迭代 map 中的每对 key 和 value, 删除符合 predicate 函数的 key, value, 返回新 map。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#OmitBy)] + [[play](https://go.dev/play/p/YJM4Hj5hNwm)] +- **OmitByKeys** : FilterByKeys 的反向操作, 迭代 map, 返回一个新 map,其 key 不包括给定的 key 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#OmitByKeys)] + [[play](https://go.dev/play/p/jXGrWDBfSRp)] +- **OmitByValues** : FilterByValues 的反向操作, 迭代 map, 返回一个新 map,其 value 不包括给定的 value 值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#OmitByValues)] + [[play](https://go.dev/play/p/XB7Y10uw20_U)] +- **Intersect** : 多个 map 的交集操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Intersect)] + [[play](https://go.dev/play/p/Zld0oj3sjcC)] +- **Keys** : 返回 map 中所有 key 组成的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Keys)] + [[play](https://go.dev/play/p/xNB5bTb97Wd)] +- **KeysBy** : 创建一个切片,其元素是每个 map 的 key 调用 mapper 函数的结果。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil#KeysBy)] + [[play](https://go.dev/play/p/hI371iB8Up8)] +- **Merge** : 合并多个 map, 相同的 key 会被之后的 key 覆盖。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Merge)] + [[play](https://go.dev/play/p/H95LENF1uB-)] +- **Minus** : 返回一个 map,其中的 key 存在于 mapA,不存在于 mapB。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Minus)] + [[play](https://go.dev/play/p/3u5U9K7YZ9m)] +- **Values** : 返回 map 中所有 values 组成的切片 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Values)] + [[play](https://go.dev/play/p/CBKdUc5FTW6)] +- **ValuesBy** : 创建一个切片,其元素是每个 map 的 value 调用 mapper 函数的结果。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ValuesBy)] + [[play](https://go.dev/play/p/sg9-oRidh8f)] +- **MapKeys** : 操作 map 的每个 key,然后转为新的 map。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapKeys)] + [[play](https://go.dev/play/p/8scDxWeBDKd)] +- **MapValues** : 操作 map 的每个 value,然后转为新的 map。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapValues)] + [[play](https://go.dev/play/p/g92aY3fc7Iw)] +- **Entries** : 将 map 转换为键/值对切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Entries)] + [[play](https://go.dev/play/p/Ltb11LNcElY)] +- **FromEntries** : 基于键/值对的切片创建 map。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#FromEntries)] + [[play](https://go.dev/play/p/fTdu4sCNjQO)] +- **Transform** : 将 map 转换为其他类型的 map。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#Transform)] + [[play](https://go.dev/play/p/P6ovfToM3zj)] +- **IsDisjoint** : 验证两个 map 是否具有不同的 key。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#IsDisjoint)] + [[play](https://go.dev/play/p/N9qgYg_Ho6f)] +- **HasKey** : 检查 map 是否包含某个 key。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#HasKey)] + [[play](https://go.dev/play/p/isZZHOsDhFc)] +- **GetOrSet** : 返回给定键的值,如果不存在则设置该值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#GetOrSet)] + [[play](https://go.dev/play/p/IVQwO1OkEJC)] +- **MapToStruct** : 将 map 转成 struct。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#MapToStruct)] + [[play](https://go.dev/play/p/7wYyVfX38Dp)] +- **ToSortedSlicesDefault** : 将 map 的 key 和 value 转化成两个根据 key 的值从小到大排序的切片,value 切片中元素的位置与 key 对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ToSortedSlicesDefault)] + [[play](https://go.dev/play/p/43gEM2po-qy)] +- **ToSortedSlicesWithComparator** : 将 map 的 key 和 value 转化成两个使用比较器函数根据 key 的值自定义排序规则的切片,value 切片中元素的位置与 key 对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ToSortedSlicesWithComparator)] + [[play](https://go.dev/play/p/0nlPo6YLdt3)] +- **NewOrderedMap** : 创建有序映射。有序映射是键值对的集合,其中键是唯一的,并且保留键插入的顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#NewOrderedMap)] + [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] +- **OrderedMap_Set** : 设置给定的键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Set)] + [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] +- **OrderedMap_Get** : 返回给定键的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Get)] + [[play](https://go.dev/play/p/Y4ZJ_oOc1FU)] +- **OrderedMap_Delete** : 删除给定键的键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Delete)] + [[play](ttps://go.dev/play/p/5bIi4yaZ3K-)] +- **OrderedMap_Clear** : 清空 map 数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Clear)] + [[play](https://go.dev/play/p/8LwoJyEfuFr)] +- **OrderedMap_Front** : 返回第一个键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Front)] + [[play](https://go.dev/play/p/ty57XSimpoe)] +- **OrderedMap_Back** : 返回最后一个键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Back)] + [[play](https://go.dev/play/p/rQMjp1yQmpa)] +- **OrderedMap_Range** : 为每个键值对调用给定的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Range)] + [[play](https://go.dev/play/p/U-KpORhc7LZ)] +- **OrderedMap_Keys** : 按顺序返回键的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Keys)] + [[play](https://go.dev/play/p/Vv_y9ExKclA)] +- **OrderedMap_Values** : 按顺序返回值的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Values)] + [[play](https://go.dev/play/p/TWj5n1-PUfx)] +- **OrderedMap_Elements** : 按顺序返回键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Elements)] + [[play](https://go.dev/play/p/4BHG4kKz6bB)] +- **OrderedMap_Len** : 返回键值对的数量。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Len)] + [[play](https://go.dev/play/p/cLe6z2VX5N-)] +- **OrderedMap_Contains** : 如果给定的键存在则返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Contains)] + [[play](https://go.dev/play/p/QuwqqnzwDNX)] +- **OrderedMap_Iter** : 返回按顺序产生键值对的通道。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Iter)] + [[play](https://go.dev/play/p/tlq2tdvicPt)] +- **OrderedMap_ReverseIter** : 返回以相反顺序产生键值对的通道。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_ReverseIter)] + [[play](https://go.dev/play/p/8Q0ssg6hZzO)] +- **OrderedMap_SortByKey** : 使用传入的比较函数排序 map key。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_SortByKey)] + [[play](https://go.dev/play/p/N7hjD_alZPq)] +- **OrderedMap_MarshalJSON** : 实现 json.Marshaler 接口。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_MarshalJSON)] + [[play](https://go.dev/play/p/C-wAwydIAC7)] +- **OrderedMap_UnmarshalJSON** : 实现 json.Unmarshaler 接口。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_UnmarshalJSON)] + [[play](https://go.dev/play/p/8C3MvJ3-mut)] +- **NewConcurrentMap** : ConcurrentMap 协程安全的 map 结构。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#NewConcurrentMap)] + [[play](https://go.dev/play/p/3PenTPETJT0)] +- **ConcurrentMap_Set** : 在 map 中设置 key 和 value。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Set)] + [[play](https://go.dev/play/p/3PenTPETJT0)] +- **ConcurrentMap_Get** : 根据 key 获取 value, 如果不存在 key,返回零值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Get)] + [[play](https://go.dev/play/p/3PenTPETJT0)] +- **ConcurrentMap_GetOrSet** : 返回键的现有值(如果存在),否则,设置 key 并返回给定值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_GetOrSet)] + [[play](https://go.dev/play/p/aDcDApOK01a)] +- **ConcurrentMap_Delete** : 删除 key。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Delete)] + [[play](https://go.dev/play/p/uTIJZYhpVMS)] +- **ConcurrentMap_GetAndDelete** :获取 key,然后删除。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_GetAndDelete)] + [[play](https://go.dev/play/p/ZyxeIXSZUiM)] +- **ConcurrentMap_Has** : 验证是否包含 key。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Has)] + [[play](https://go.dev/play/p/C8L4ul9TVwf)] +- **ConcurrentMap_Range** : 为 map 中每个键和值顺序调用迭代器。 如果 iterator 返回 false,则停止迭代。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ConcurrentMap_Range)] + [[play](https://go.dev/play/p/iqcy7P8P0Pr)] +- **SortByKey** : 对传入的 map 根据 key 进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#SortByKey)] + [[play](https://go.dev/play/p/PVdmBSnm6P_W)] +- **GetOrDefault** : 返回给定键的值,如果键不存在,则返回默认值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#GetOrDefault)] + [[play](https://go.dev/play/p/99QjSYSBdiM)] +- **FindValuesBy** : 返回一个切片,包含满足给定谓词判断函数的 map 中的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#FindValuesBy)] + [[play](https://go.dev/play/p/bvNwNBZDm6v)] +- **ToMarkdownTable** : 将一个 map 切片数据转换为 Markdown 表格字符串。支持自定义表头显示名称和列的显示顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#ToMarkdownTable)] + [[play](https://go.dev/play/p/w_pSLfeyEB5)]

15. mathutil 包实现了一些数学计算的函数。       回到目录

@@ -1251,108 +1251,108 @@ import "github.com/duke-git/lancet/v2/mathutil" #### 函数列表: -- **Average** :计算平均数,可能需要对结果调用 RoundToFloat 方法四舍五入。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Average)] - [[play](https://go.dev/play/p/Vv7LBwER-pz)] -- **Exponent** : 指数计算(x 的 n 次方)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Exponent)] - [[play](https://go.dev/play/p/uF3HGNPk8wr)] -- **Fibonacci** :计算斐波那契数列的第 n 个数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Fibonacci)] - [[play](https://go.dev/play/p/IscseUNMuUc)] -- **Factorial** : 计算阶乘。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Factorial)] - [[play](https://go.dev/play/p/tt6LdOK67Nx)] -- **Max** : 返回参数中的最大数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Max)] - [[play](https://go.dev/play/p/cN8DHI0rTkH)] -- **MaxBy** : 使用给定的比较器函数返回切片的最大值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#MaxBy)] - [[play](https://go.dev/play/p/pbe2MT-7DV2)] -- **Min** : 返回参数中的最小数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Min)] - [[play](https://go.dev/play/p/21BER_mlGUj)] -- **MinBy** : 使用给定的比较器函数返回切片的最小值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#MinBy)] - [[play](https://go.dev/play/p/N9qgYg_Ho6f)] -- **Percent** : 计算百分比,可以指定保留 n 位小数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Percent)] - [[play](https://go.dev/play/p/s0NdFCtwuyd)] -- **RoundToFloat** : 四舍五入,保留 n 位小数,返回 float64。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RoundToFloat)] - [[play](https://go.dev/play/p/ghyb528JRJL)] -- **RoundToString** : 四舍五入,保留 n 位小数,返回 string。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RoundToString)] - [[play](https://go.dev/play/p/kZwpBRAcllO)] -- **TruncRound** : 截短 n 位小数(不进行四舍五入)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#TruncRound)] - [[play](https://go.dev/play/p/aumarSHIGzP)] -- **CeilToFloat** : 向上舍入(进一法),保留 n 位小数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#CeilToFloat)] - [[play](https://go.dev/play/p/8hOeSADZPCo)] -- **CeilToString** : 向上舍入(进一法),保留 n 位小数,返回字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#CeilToString)] - [[play](https://go.dev/play/p/wy5bYEyUKKG)] -- **FloorToFloat** : 向下舍入(去尾法),保留 n 位小数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#FloorToFloat)] - [[play](https://go.dev/play/p/vbCBrQHZEED)] -- **FloorToString** : 向下舍入(去尾法),保留 n 位小数,返回字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#FloorToString)] - [[play](https://go.dev/play/p/Qk9KPd2IdDb)] -- **Range** : 根据指定的起始值和数量,创建一个数字切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Range)] - [[play](https://go.dev/play/p/9ke2opxa8ZP)] -- **RangeWithStep** : 根据指定的起始值,结束值,步长,创建一个数字切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RangeWithStep)] - [[play](https://go.dev/play/p/akLWz0EqOSM)] -- **AngleToRadian** : 将角度值转为弧度值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#AngleToRadian)] - [[play](https://go.dev/play/p/CIvlICqrHql)] -- **RadianToAngle** : 将弧度值转为角度值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RadianToAngle)] - [[play](https://go.dev/play/p/dQtmOTUOMgi)] -- **PointDistance** : 计算两个坐标点的距离。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#PointDistance)] - [[play](https://go.dev/play/p/RrG4JIaziM8)] -- **IsPrime** : 判断质数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#IsPrime)] - [[play](https://go.dev/play/p/Rdd8UTHZJ7u)] -- **GCD** : 求最大公约数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#GCD)] - [[play](https://go.dev/play/p/CiEceLSoAKB)] -- **LCM** : 求最小公倍数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#LCM)] - [[play](https://go.dev/play/p/EjcZxfY7G_g)] -- **Cos** : 计算弧度的余弦值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Cos)] - [[play](https://go.dev/play/p/Sm89LoIfvFq)] -- **Sin** : 计算弧度的正弦值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Sin)] - [[play](https://go.dev/play/p/TWMQlMywDsP)] -- **Log** : 计算以 base 为底 n 的对数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Log)] - [[play](https://go.dev/play/p/_d4bi8oyhat)] -- **Sum** : 求传入参数之和。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Sum)] - [[play](https://go.dev/play/p/1To2ImAMJA7)] -- **Abs** : 求绝对值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Sum)] - [[play](https://go.dev/play/p/fsyBh1Os-1d)] -- **Div** : 除法运算。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Div)] - [[play](https://go.dev/play/p/WLxDdGXXYat)] -- **Variance** : 计算方差。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Variance)] - [[play](https://go.dev/play/p/uHuV4YgXf8F)] -- **StdDev** : 计算标准差。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#StdDev)] - [[play](https://go.dev/play/p/FkNZDXvHD2l)] -- **Permutation** : 计算排列数 P(n, k)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Permutation)] - [[play](https://go.dev/play/p/MgobwH_FOxj)] -- **Combination** : 计算组合数 C(n, k)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Combination)] - [[play](https://go.dev/play/p/ENFQRDQUFi9)] +- **Average** :计算平均数,可能需要对结果调用 RoundToFloat 方法四舍五入。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Average)] + [[play](https://go.dev/play/p/Vv7LBwER-pz)] +- **Exponent** : 指数计算(x 的 n 次方)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Exponent)] + [[play](https://go.dev/play/p/uF3HGNPk8wr)] +- **Fibonacci** :计算斐波那契数列的第 n 个数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Fibonacci)] + [[play](https://go.dev/play/p/IscseUNMuUc)] +- **Factorial** : 计算阶乘。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Factorial)] + [[play](https://go.dev/play/p/tt6LdOK67Nx)] +- **Max** : 返回参数中的最大数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Max)] + [[play](https://go.dev/play/p/cN8DHI0rTkH)] +- **MaxBy** : 使用给定的比较器函数返回切片的最大值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#MaxBy)] + [[play](https://go.dev/play/p/pbe2MT-7DV2)] +- **Min** : 返回参数中的最小数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Min)] + [[play](https://go.dev/play/p/21BER_mlGUj)] +- **MinBy** : 使用给定的比较器函数返回切片的最小值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#MinBy)] + [[play](https://go.dev/play/p/N9qgYg_Ho6f)] +- **Percent** : 计算百分比,可以指定保留 n 位小数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Percent)] + [[play](https://go.dev/play/p/s0NdFCtwuyd)] +- **RoundToFloat** : 四舍五入,保留 n 位小数,返回 float64。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RoundToFloat)] + [[play](https://go.dev/play/p/ghyb528JRJL)] +- **RoundToString** : 四舍五入,保留 n 位小数,返回 string。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RoundToString)] + [[play](https://go.dev/play/p/kZwpBRAcllO)] +- **TruncRound** : 截短 n 位小数(不进行四舍五入)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#TruncRound)] + [[play](https://go.dev/play/p/aumarSHIGzP)] +- **CeilToFloat** : 向上舍入(进一法),保留 n 位小数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#CeilToFloat)] + [[play](https://go.dev/play/p/8hOeSADZPCo)] +- **CeilToString** : 向上舍入(进一法),保留 n 位小数,返回字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#CeilToString)] + [[play](https://go.dev/play/p/wy5bYEyUKKG)] +- **FloorToFloat** : 向下舍入(去尾法),保留 n 位小数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#FloorToFloat)] + [[play](https://go.dev/play/p/vbCBrQHZEED)] +- **FloorToString** : 向下舍入(去尾法),保留 n 位小数,返回字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#FloorToString)] + [[play](https://go.dev/play/p/Qk9KPd2IdDb)] +- **Range** : 根据指定的起始值和数量,创建一个数字切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Range)] + [[play](https://go.dev/play/p/9ke2opxa8ZP)] +- **RangeWithStep** : 根据指定的起始值,结束值,步长,创建一个数字切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RangeWithStep)] + [[play](https://go.dev/play/p/akLWz0EqOSM)] +- **AngleToRadian** : 将角度值转为弧度值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#AngleToRadian)] + [[play](https://go.dev/play/p/CIvlICqrHql)] +- **RadianToAngle** : 将弧度值转为角度值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#RadianToAngle)] + [[play](https://go.dev/play/p/dQtmOTUOMgi)] +- **PointDistance** : 计算两个坐标点的距离。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#PointDistance)] + [[play](https://go.dev/play/p/RrG4JIaziM8)] +- **IsPrime** : 判断质数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#IsPrime)] + [[play](https://go.dev/play/p/Rdd8UTHZJ7u)] +- **GCD** : 求最大公约数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#GCD)] + [[play](https://go.dev/play/p/CiEceLSoAKB)] +- **LCM** : 求最小公倍数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#LCM)] + [[play](https://go.dev/play/p/EjcZxfY7G_g)] +- **Cos** : 计算弧度的余弦值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Cos)] + [[play](https://go.dev/play/p/Sm89LoIfvFq)] +- **Sin** : 计算弧度的正弦值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Sin)] + [[play](https://go.dev/play/p/TWMQlMywDsP)] +- **Log** : 计算以 base 为底 n 的对数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Log)] + [[play](https://go.dev/play/p/_d4bi8oyhat)] +- **Sum** : 求传入参数之和。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Sum)] + [[play](https://go.dev/play/p/1To2ImAMJA7)] +- **Abs** : 求绝对值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Sum)] + [[play](https://go.dev/play/p/fsyBh1Os-1d)] +- **Div** : 除法运算。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Div)] + [[play](https://go.dev/play/p/WLxDdGXXYat)] +- **Variance** : 计算方差。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Variance)] + [[play](https://go.dev/play/p/uHuV4YgXf8F)] +- **StdDev** : 计算标准差。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#StdDev)] + [[play](https://go.dev/play/p/FkNZDXvHD2l)] +- **Permutation** : 计算排列数 P(n, k)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Permutation)] + [[play](https://go.dev/play/p/MgobwH_FOxj)] +- **Combination** : 计算组合数 C(n, k)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/mathutil.md#Combination)] + [[play](https://go.dev/play/p/ENFQRDQUFi9)]

16. netutil 网络包支持获取 ip 地址,发送 http 请求。       回到目录

@@ -1362,76 +1362,76 @@ import "github.com/duke-git/lancet/v2/netutil" #### 函数列表: -- **ConvertMapToQueryString** : 将 map 转换成 http 查询字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#ConvertMapToQueryString)] - [[play](https://go.dev/play/p/jnNt_qoSnRi)] -- **EncodeUrl** : 编码 url query string 的值(?a=1&b=[2] -> ?a=1&b=%5B2%5D)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#EncodeUrl)] - [[play](https://go.dev/play/p/bsZ6BRC4uKI)] -- **GetInternalIp** : 获取内部 ipv4。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetInternalIp)] - [[play](https://go.dev/play/p/5mbu-gFp7ei)] -- **GetIps** : 获取系统 ipv4 地址列表。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetIps)] - [[play](https://go.dev/play/p/NUFfcEmukx1)] -- **GetMacAddrs** : 获取系统 mac 地址列。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetMacAddrs)] - [[play](https://go.dev/play/p/Rq9UUBS_Xp1)] -- **GetPublicIpInfo** : 获取[公网 ip 信息](http://ip-api.com/json/). - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetPublicIpInfo)] - [[play](https://go.dev/play/p/YDxIfozsRHR)] -- **GetRequestPublicIp** : 获取 http 请求 ip。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetRequestPublicIp)] - [[play](https://go.dev/play/p/kxU-YDc_eBo)] -- **IsPublicIP** : 判断 ip 是否是公共 ip。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsPublicIP)] - [[play](https://go.dev/play/p/nmktSQpJZnn)] -- **IsInternalIP** : 判断 ip 是否是局域网 ip。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsInternalIP)] - [[play](https://go.dev/play/p/sYGhXbgO4Cb)] -- **HttpRequest** : 用于抽象 HTTP 请求实体的结构。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpRequest)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **HttpClient** : 用于发送 HTTP 请求。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpClient)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **SendRequest** : 发送 http 请求。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#SendRequest)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **DecodeResponse** : 解析 http 响应体到目标结构体。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#DecodeResponse)] - [[play](https://go.dev/play/p/jUSgynekH7G)] -- **StructToUrlValues** : 将结构体转为 url values, 仅转化结构体导出字段并且包含`json` tag。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#StructToUrlValues)] - [[play](https://go.dev/play/p/pFqMkM40w9z)] -- **HttpGetdeprecated** : 发送 http get 请求(已弃用:SendRequest 代替)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpGet)] -- **HttpDeletedeprecated** : 发送 http delete 请求(已弃用:SendRequest 代替)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpDelete)] -- **HttpPostdeprecated** : 发送 http post 请求(已弃用:SendRequest 代替)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpPost)] -- **HttpPutdeprecated** : 发送 http put 请求(已弃用:SendRequest 代替)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpPut)] -- **HttpPatchdeprecated** : 发送 http patch 请求(已弃用:SendRequest 代替)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpPatch)] -- **ParseHttpResponse** : 解析 http 响应体到目标结构体。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#ParseHttpResponse)] -- **DownloadFile** : 从指定的 server 地址下载文件。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#DownloadFile)] -- **UploadFile** : 将文件上传指定的 server 地址。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#UploadFile)] -- **IsPingConnected** : 检查能否 ping 通主机。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsPingConnected)] - [[play](https://go.dev/play/p/q8OzTijsA87)] -- **IsTelnetConnected** : 检查能否 telnet 到主机。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsTelnetConnected)] - [[play](https://go.dev/play/p/yiLCGtQv_ZG)] -- **BuildUrl** : 创建 url 字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#BuildUrl)] - [[play](https://go.dev/play/p/JLXl1hZK7l4)] -- **AddQueryParams** : 向 url 添加查询参数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#AddQueryParams)] - [[play](https://go.dev/play/p/JLXl1hZK7l4)] +- **ConvertMapToQueryString** : 将 map 转换成 http 查询字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#ConvertMapToQueryString)] + [[play](https://go.dev/play/p/jnNt_qoSnRi)] +- **EncodeUrl** : 编码 url query string 的值(?a=1&b=[2] -> ?a=1&b=%5B2%5D)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#EncodeUrl)] + [[play](https://go.dev/play/p/bsZ6BRC4uKI)] +- **GetInternalIp** : 获取内部 ipv4。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetInternalIp)] + [[play](https://go.dev/play/p/5mbu-gFp7ei)] +- **GetIps** : 获取系统 ipv4 地址列表。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetIps)] + [[play](https://go.dev/play/p/NUFfcEmukx1)] +- **GetMacAddrs** : 获取系统 mac 地址列。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetMacAddrs)] + [[play](https://go.dev/play/p/Rq9UUBS_Xp1)] +- **GetPublicIpInfo** : 获取[公网 ip 信息](http://ip-api.com/json/). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetPublicIpInfo)] + [[play](https://go.dev/play/p/YDxIfozsRHR)] +- **GetRequestPublicIp** : 获取 http 请求 ip。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#GetRequestPublicIp)] + [[play](https://go.dev/play/p/kxU-YDc_eBo)] +- **IsPublicIP** : 判断 ip 是否是公共 ip。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsPublicIP)] + [[play](https://go.dev/play/p/nmktSQpJZnn)] +- **IsInternalIP** : 判断 ip 是否是局域网 ip。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsInternalIP)] + [[play](https://go.dev/play/p/sYGhXbgO4Cb)] +- **HttpRequest** : 用于抽象 HTTP 请求实体的结构。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpRequest)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **HttpClient** : 用于发送 HTTP 请求。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpClient)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **SendRequest** : 发送 http 请求。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#SendRequest)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **DecodeResponse** : 解析 http 响应体到目标结构体。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#DecodeResponse)] + [[play](https://go.dev/play/p/jUSgynekH7G)] +- **StructToUrlValues** : 将结构体转为 url values, 仅转化结构体导出字段并且包含`json` tag。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#StructToUrlValues)] + [[play](https://go.dev/play/p/pFqMkM40w9z)] +- **HttpGetdeprecated** : 发送 http get 请求(已弃用:SendRequest 代替)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpGet)] +- **HttpDeletedeprecated** : 发送 http delete 请求(已弃用:SendRequest 代替)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpDelete)] +- **HttpPostdeprecated** : 发送 http post 请求(已弃用:SendRequest 代替)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpPost)] +- **HttpPutdeprecated** : 发送 http put 请求(已弃用:SendRequest 代替)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpPut)] +- **HttpPatchdeprecated** : 发送 http patch 请求(已弃用:SendRequest 代替)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#HttpPatch)] +- **ParseHttpResponse** : 解析 http 响应体到目标结构体。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#ParseHttpResponse)] +- **DownloadFile** : 从指定的 server 地址下载文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#DownloadFile)] +- **UploadFile** : 将文件上传指定的 server 地址。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#UploadFile)] +- **IsPingConnected** : 检查能否 ping 通主机。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsPingConnected)] + [[play](https://go.dev/play/p/q8OzTijsA87)] +- **IsTelnetConnected** : 检查能否 telnet 到主机。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#IsTelnetConnected)] + [[play](https://go.dev/play/p/yiLCGtQv_ZG)] +- **BuildUrl** : 创建 url 字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#BuildUrl)] + [[play](https://go.dev/play/p/JLXl1hZK7l4)] +- **AddQueryParams** : 向 url 添加查询参数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/netutil.md#AddQueryParams)] + [[play](https://go.dev/play/p/JLXl1hZK7l4)]

17. pointer 包支持一些指针类型的操作。       回到目录

@@ -1441,21 +1441,21 @@ import "github.com/duke-git/lancet/v2/pointer" #### 函数列表: -- **ExtractPointer** : 返回传入 interface 的底层值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#ExtractPointer)] - [[play](https://go.dev/play/p/D7HFjeWU2ZP)] -- **Of** : 返回传入参数的指针值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#Of)] - [[play](https://go.dev/play/p/HFd70x4DrMj)] -- **Unwrap** : 返回传入指针指向的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#Unwrap)] - [[play](https://go.dev/play/p/cgeu3g7cjWb) -- **UnwarpOr** : 返回指针的值,如果指针为零值,则返回 fallback。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#UnwrapOr)] - [[play](https://go.dev/play/p/mmNaLC38W8C)] -- **UnwarpOrDefault** : 返回指针的值,如果指针为零值,则返回相应零值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#UnwrapOrDefault)] - [[play](https://go.dev/play/p/ZnGIHf8_o4E)] +- **ExtractPointer** : 返回传入 interface 的底层值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#ExtractPointer)] + [[play](https://go.dev/play/p/D7HFjeWU2ZP)] +- **Of** : 返回传入参数的指针值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#Of)] + [[play](https://go.dev/play/p/HFd70x4DrMj)] +- **Unwrap** : 返回传入指针指向的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#Unwrap)] + [[play](https://go.dev/play/p/cgeu3g7cjWb) +- **UnwarpOr** : 返回指针的值,如果指针为零值,则返回 fallback。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#UnwrapOr)] + [[play](https://go.dev/play/p/mmNaLC38W8C)] +- **UnwarpOrDefault** : 返回指针的值,如果指针为零值,则返回相应零值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/pointer.md#UnwrapOrDefault)] + [[play](https://go.dev/play/p/ZnGIHf8_o4E)]

18. random 随机数生成器包,可以生成随机[]bytes, int, string。       回到目录

@@ -1465,63 +1465,63 @@ import "github.com/duke-git/lancet/v2/random" #### 函数列表: -- **RandBytes** : 生成随机字节切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBytes)] - [[play](https://go.dev/play/p/EkiLESeXf8d)] -- **RandInt** : 生成随机 int, 范围[min, max)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandInt)] - [[play](https://go.dev/play/p/pXyyAAI5YxD)] -- **RandString** : 生成给定长度的随机字符串,只包含字母(a-zA-Z)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandString)] - [[play](https://go.dev/play/p/W2xvRUXA7Mi)] -- **RandUpper** : 生成给定长度的随机大写字母字符串(A-Z)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandUpper)] - [[play](https://go.dev/play/p/29QfOh0DVuh)] -- **RandLower** : 生成给定长度的随机小写字母字符串(a-z)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandLower)] - [[play](https://go.dev/play/p/XJtZ471cmtI)] -- **RandNumeral** : 生成给定长度的随机数字字符串(0-9)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandNumeral)] - [[play](https://go.dev/play/p/g4JWVpHsJcf)] -- **RandNumeralOrLetter** : 生成给定长度的随机字符串(数字+字母)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandNumeralOrLetter)] - [[play](https://go.dev/play/p/19CEQvpx2jD)] -- **UUIdV4** : 生成 UUID v4 字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#UUIdV4)] - [[play](https://go.dev/play/p/_Z9SFmr28ft)] -- **RandUniqueIntSlice** : 生成一个不重复的随机 int 切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandUniqueIntSlice)] - [[play](https://go.dev/play/p/uBkRSOz73Ec)] -- **RandSymbolChar** : 生成给定长度的随机符号字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandSymbolChar)] - [[play](https://go.dev/play/p/Im6ZJxAykOm)] -- **RandFloat** : 生成随机 float64 数字,可以指定范围和精度。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFloat)] - [[play](https://go.dev/play/p/zbD_tuobJtr)] -- **RandFloats** : 生成随机 float64 数字切片,可以指定长度,范围和精度. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFloats)] - [[play](https://go.dev/play/p/uBkRSOz73Ec)] -- **RandStringSlice** : 生成随机字符串 slice。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandStringSlice)] - [[play](https://go.dev/play/p/2_-PiDv3tGn)] -- **RandBool** : 生成随机 bool 值(true or false)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBool)] - [[play](https://go.dev/play/p/to6BLc26wBv)] -- **RandBoolSlice** : 生成特定长度的随机 bool slice。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBoolSlice)] - [[play](https://go.dev/play/p/o-VSjPjnILI)] -- **RandIntSlice** : 生成一个特定长度的随机 int 切片,数值范围[min, max)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandIntSlice)] - [[play](https://go.dev/play/p/GATTQ5xTEG8)] -- **RandFromGivenSlice** : 从给定切片中随机生成元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFromGivenSlice)] - [[play](https://go.dev/play/p/UrkWueF6yYo)] -- **RandSliceFromGivenSlice** : 从给定切片中生成长度为 num 的随机切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandSliceFromGivenSlice)] - [[play](https://go.dev/play/p/68UikN9d6VT)] -- **RandNumberOfLength** : 生成指定长度的随机数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandNumberOfLength)] - [[play](https://go.dev/play/p/oyZbuV7bu7b)] +- **RandBytes** : 生成随机字节切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBytes)] + [[play](https://go.dev/play/p/EkiLESeXf8d)] +- **RandInt** : 生成随机 int, 范围[min, max)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandInt)] + [[play](https://go.dev/play/p/pXyyAAI5YxD)] +- **RandString** : 生成给定长度的随机字符串,只包含字母(a-zA-Z)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandString)] + [[play](https://go.dev/play/p/W2xvRUXA7Mi)] +- **RandUpper** : 生成给定长度的随机大写字母字符串(A-Z)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandUpper)] + [[play](https://go.dev/play/p/29QfOh0DVuh)] +- **RandLower** : 生成给定长度的随机小写字母字符串(a-z)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandLower)] + [[play](https://go.dev/play/p/XJtZ471cmtI)] +- **RandNumeral** : 生成给定长度的随机数字字符串(0-9)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandNumeral)] + [[play](https://go.dev/play/p/g4JWVpHsJcf)] +- **RandNumeralOrLetter** : 生成给定长度的随机字符串(数字+字母)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandNumeralOrLetter)] + [[play](https://go.dev/play/p/19CEQvpx2jD)] +- **UUIdV4** : 生成 UUID v4 字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#UUIdV4)] + [[play](https://go.dev/play/p/_Z9SFmr28ft)] +- **RandUniqueIntSlice** : 生成一个不重复的随机 int 切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandUniqueIntSlice)] + [[play](https://go.dev/play/p/uBkRSOz73Ec)] +- **RandSymbolChar** : 生成给定长度的随机符号字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandSymbolChar)] + [[play](https://go.dev/play/p/Im6ZJxAykOm)] +- **RandFloat** : 生成随机 float64 数字,可以指定范围和精度。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFloat)] + [[play](https://go.dev/play/p/zbD_tuobJtr)] +- **RandFloats** : 生成随机 float64 数字切片,可以指定长度,范围和精度. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFloats)] + [[play](https://go.dev/play/p/uBkRSOz73Ec)] +- **RandStringSlice** : 生成随机字符串 slice。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandStringSlice)] + [[play](https://go.dev/play/p/2_-PiDv3tGn)] +- **RandBool** : 生成随机 bool 值(true or false)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBool)] + [[play](https://go.dev/play/p/to6BLc26wBv)] +- **RandBoolSlice** : 生成特定长度的随机 bool slice。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBoolSlice)] + [[play](https://go.dev/play/p/o-VSjPjnILI)] +- **RandIntSlice** : 生成一个特定长度的随机 int 切片,数值范围[min, max)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandIntSlice)] + [[play](https://go.dev/play/p/GATTQ5xTEG8)] +- **RandFromGivenSlice** : 从给定切片中随机生成元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFromGivenSlice)] + [[play](https://go.dev/play/p/UrkWueF6yYo)] +- **RandSliceFromGivenSlice** : 从给定切片中生成长度为 num 的随机切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandSliceFromGivenSlice)] + [[play](https://go.dev/play/p/68UikN9d6VT)] +- **RandNumberOfLength** : 生成指定长度的随机数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandNumberOfLength)] + [[play](https://go.dev/play/p/oyZbuV7bu7b)]

19. retry 重试执行函数直到函数运行成功或被 context cancel。       回到目录

@@ -1531,29 +1531,29 @@ import "github.com/duke-git/lancet/v2/retry" #### 函数列表: -- **Context** : 设置重试 context 参数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#Context)] - [[play](https://go.dev/play/p/xnAOOXv9GkS)] -- **Retry** : 重试执行函数 retryFunc,直到函数运行成功,或被 context 取消。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#Retry)] - [[play](https://go.dev/play/p/nk2XRmagfVF)] -- **RetryFunc** : 重试执行的函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryFunc)] - [[play](https://go.dev/play/p/nk2XRmagfVF)] -- **RetryTimes** : 设置重试次数,默认 5。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryTimes)] - [[play](https://go.dev/play/p/ssfVeU2SwLO)] -- **BackoffStrategy** : 定义计算退避间隔的方法的接口。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#BackoffStrategy)] -- **RetryWithCustomBackoff** : 设置自定义退避策略。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryWithCustomBackoff)] - [[play](https://go.dev/play/p/jIm_o2vb5Y4)] -- **RetryWithLinearBackoff** : 设置线性策略退避。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryWithLinearBackoff)] - [[play](https://go.dev/play/p/PDet2ZQZwcB)] -- **RetryWithExponentialWithJitterBackoff** : 设置指数策略退避。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryWithExponentialWithJitterBackoff)] - [[play](https://go.dev/play/p/xp1avQmn16X)] +- **Context** : 设置重试 context 参数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#Context)] + [[play](https://go.dev/play/p/xnAOOXv9GkS)] +- **Retry** : 重试执行函数 retryFunc,直到函数运行成功,或被 context 取消。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#Retry)] + [[play](https://go.dev/play/p/nk2XRmagfVF)] +- **RetryFunc** : 重试执行的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryFunc)] + [[play](https://go.dev/play/p/nk2XRmagfVF)] +- **RetryTimes** : 设置重试次数,默认 5。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryTimes)] + [[play](https://go.dev/play/p/ssfVeU2SwLO)] +- **BackoffStrategy** : 定义计算退避间隔的方法的接口。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#BackoffStrategy)] +- **RetryWithCustomBackoff** : 设置自定义退避策略。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryWithCustomBackoff)] + [[play](https://go.dev/play/p/jIm_o2vb5Y4)] +- **RetryWithLinearBackoff** : 设置线性策略退避。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryWithLinearBackoff)] + [[play](https://go.dev/play/p/PDet2ZQZwcB)] +- **RetryWithExponentialWithJitterBackoff** : 设置指数策略退避。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/retry.md#RetryWithExponentialWithJitterBackoff)] + [[play](https://go.dev/play/p/xp1avQmn16X)]

20. slice 包含操作切片的方法集合。        回到目录

@@ -1563,271 +1563,271 @@ import "github.com/duke-git/lancet/v2/slice" #### 函数列表: -- **AppendIfAbsent** : 当前切片中不包含值时,将该值追加到切片中。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#AppendIfAbsent)] - [[play](https://go.dev/play/p/GNdv7Jg2Taj)] -- **Contain** : 判断 slice 是否包含 value。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Contain)] - [[play](https://go.dev/play/p/_454yEHcNjf)] -- **ContainBy** : 根据 predicate 函数判断切片是否包含某个值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ContainBy)] - [[play](https://go.dev/play/p/49tkHfX4GNc)] -- **ContainSubSlice** : 判断 slice 是否包含 subslice。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ContainSubSlice)] - [[play](https://go.dev/play/p/bcuQ3UT6Sev)] -- **ContainAny** : 判断 slice 是否包含 targets 切片中的任意一个元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ContainAny)] - [[play](https://go.dev/play/p/4xoxhc9XSSw)] -- **Chunk** : 按照 size 参数均分 slice。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Chunk)] - [[play](https://go.dev/play/p/b4Pou5j2L_C)] -- **Compact** : 去除 slice 中的假值(false values are false, nil, 0, "")。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Compact)] - [[play](https://go.dev/play/p/pO5AnxEr3TK)] -- **Concat** : 合并多个 slices 到一个 slice 中。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Concat)] - [[play](https://go.dev/play/p/gPt-q7zr5mk)] -- **Count** : 返回切片中指定元素的个数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Count)] - [[play](https://go.dev/play/p/Mj4oiEnQvRJ)] -- **CountBy** : 遍历切片,对每个元素执行函数 predicate. 返回符合函数返回值为 true 的元素的个数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#CountBy)] - [[play](https://go.dev/play/p/tHOccTMDZCC)] -- **Difference** : 创建一个切片,其元素不包含在另一个给定切片中。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Difference)] - [[play](https://go.dev/play/p/VXvadzLzhDa)] -- **DifferenceBy** : 将两个 slice 中的每个元素调用 iteratee 函数,并比较它们的返回值,如果不相等返回在 slice 中对应的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DifferenceBy)] - [[play](https://go.dev/play/p/DiivgwM5OnC)] -- **DifferenceWith** : 接受比较器函数,该比较器被调用以将切片的元素与值进行比较。 结果值的顺序和引用由第一个切片确定。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DifferenceWith)] - [[play](https://go.dev/play/p/v2U2deugKuV)] -- **DeleteAt** : 删除切片中指定索引到的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DeleteAt)] - [[play](https://go.dev/play/p/800B1dPBYyd)] -- **DeleteRange** : 删除切片中指定开始索引到结束索引的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DeleteRange)] - [[play](https://go.dev/play/p/945HwiNrnle)] -- **Drop** : 从切片头部删除 n 个元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Drop)] - [[play](https://go.dev/play/p/jnPO2yQsT8H)] -- **DropRight** : 从切片尾部删除 n 个元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DropRight)] - [[play](https://go.dev/play/p/8bcXvywZezG)] -- **DropWhile** : 从切片的头部删除 n 个元素,这个 n 个元素满足 predicate 函数返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DropWhile)] - [[play](https://go.dev/play/p/4rt252UV_qs)] -- **DropRightWhile** : 从切片的尾部删除 n 个元素,这个 n 个元素满足 predicate 函数返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DropRightWhile)] - [[play](https://go.dev/play/p/6wyK3zMY56e)] -- **Equal** : 检查两个切片是否相等,相等条件:切片长度相同,元素顺序和值都相同。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Equal)] - [[play](https://go.dev/play/p/WcRQJ37ifPa)] -- **EqualWith** : 检查两个切片是否相等,相等条件:对两个切片的元素调用比较函数 comparator,返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#EqualWith)] - [[play](https://go.dev/play/p/b9iygtgsHI1)] -- **EqualUnordered** : 检查两个切片是否相等,元素数量相同,值相等,不考虑元素顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#EqualUnordered)] - [[play](https://go.dev/play/p/n8fSc2w8ZgX)] -- **Every** : 如果切片中的所有值都通过谓词函数,则返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Every)] - [[play](https://go.dev/play/p/R8U6Sl-j8cD)] -- **Filter** : 返回切片中通过 predicate 函数真值测试的所有元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Filter)] - [[play](https://go.dev/play/p/SdPna-7qK4T)] -- **FilterMap** : 返回一个将 filter 和 map 操作应用于给定切片的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FilterMap)] - [[play](https://go.dev/play/p/J94SZ_9MiIe)] -- **Finddeprecated** : 遍历切片的元素,返回第一个通过 predicate 函数真值测试的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Find)] - [[play](https://go.dev/play/p/CBKeBoHVLgq)] -- **FindBy** : 遍历切片的元素,返回第一个通过 predicate 函数真值测试的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FindBy)] - [[play](https://go.dev/play/p/n1lysBYl-GB)] -- **FindLastdeprecated** : 从头到尾遍历 slice 的元素,返回最后一个通过 predicate 函数真值测试的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FindLast)] - [[play](https://go.dev/play/p/FFDPV_j7URd)] -- **FindLastBy** : 从遍历 slice 的元素,返回最后一个通过 predicate 函数真值测试的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FindLastBy)] - [[play](https://go.dev/play/p/8iqomzyCl_s)] -- **Flatten** : 将多维切片展平一层。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Flatten)] - [[play](https://go.dev/play/p/hYa3cBEevtm)] -- **FlattenDeep** : 将多维切片递归展平到一层。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FlattenDeep)] - [[play](https://go.dev/play/p/yjYNHPyCFaF)] -- **FlatMap** : 将切片转换为其它类型切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FlatMap)] - [[play](https://go.dev/play/p/_QARWlWs1N_F)] -- **ForEach** : 遍历切片的元素并为每个元素调用 iteratee 函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ForEach)] - [[play](https://go.dev/play/p/DrPaa4YsHRF)] -- **ForEachConcurrent** : 对 slice 并发执行 foreach 操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ForEachConcurrent)] - [[play](https://go.dev/play/p/kT4XW7DKVoV)] -- **ForEachWithBreak** : 遍历切片的元素并为每个元素调用 iteratee 函数,当 iteratee 函数返回 false 时,终止遍历。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ForEachWithBreak)] - [[play](https://go.dev/play/p/qScs39f3D9W)] -- **GroupBy** : 迭代切片的元素,每个元素将按条件分组,返回两个切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#GroupBy)] - [[play](https://go.dev/play/p/QVkPxzPR0iA)] -- **GroupWith** : 创建一个 map,key 是 iteratee 遍历 slice 中的每个元素返回的结果。值是切片元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#GroupWith)] - [[play](https://go.dev/play/p/ApCvMNTLO8a)] -- **IntSlicedeprecated** : 将接口切片转换为 int 切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IntSlice)] - [[play](https://go.dev/play/p/FdQXF0Vvqs-)] -- **InterfaceSlicedeprecated** : 将值转换为 interface 切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#InterfaceSlice)] - [[play](https://go.dev/play/p/FdQXF0Vvqs-)] -- **Intersection** : 返回多个切片的交集。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Intersection)] - [[play](https://go.dev/play/p/anJXfB5wq_t)] -- **InsertAt** : 将元素插入到索引处的切片中。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#InsertAt)] - [[play](https://go.dev/play/p/hMLNxPEGJVE)] -- **IndexOf** : 返回在切片中找到值的第一个匹配项的索引,如果找不到值,则返回-1。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IndexOf)] - [[play](https://go.dev/play/p/MRN1f0FpABb)] -- **LastIndexOf** : 返回在切片中找到最后一个值的索引,如果找不到该值,则返回-1。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#LastIndexOf)] - [[play](https://go.dev/play/p/DokM4cf1IKH)] -- **Map** : 对 slice 中的每个元素执行 map 函数以创建一个新切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Map)] - [[play](https://go.dev/play/p/biaTefqPquw)] -- **MapConcurrent** : 对 slice 并发执行 map 操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#MapConcurrent)] - [[play](https://go.dev/play/p/H1ehfPkPen0)] -- **Merge** : 合并多个切片(不会消除重复元素)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Merge)] - [[play](https://go.dev/play/p/lbjFp784r9N)] -- **Reverse** : 反转切片中的元素顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Reverse)] - [[play](https://go.dev/play/p/8uI8f1lwNrQ)] -- **ReverseCopy** : 反转切片中的元素顺序, 不改变原 slice。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#ReverseCopy)] - [[play](https://go.dev/play/p/c9arEaP7Cg-)] -- **Reducedeprecated** : 将切片中的元素依次运行 iteratee 函数,返回运行结果。(废弃:建议使用 ReduceBy) - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Reduce)] - [[play](https://go.dev/play/p/_RfXJJWIsIm)] -- **ReduceBy** : 对切片元素执行 reduce 操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReduceBy)] - [[play](https://go.dev/play/p/YKDpLi7gtee)] -- **ReduceRight** : 类似 ReduceBy 操作,迭代切片元素顺序从右至左。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReduceRight)] - [[play](https://go.dev/play/p/qT9dZC03A1K)] -- **ReduceConcurrent** : 对切片元素执行并发 reduce 操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReduceConcurrent)] - [[play](https://go.dev/play/p/Tjwe6OtaG07)] -- **Replace** : 返回切片的副本,其中前 n 个不重叠的 old 替换为 new。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Replace)] - [[play](https://go.dev/play/p/P5mZp7IhOFo)] -- **ReplaceAll** : 返回切片的副本,将其中 old 全部替换为 new。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReplaceAll)] - [[play](https://go.dev/play/p/CzqXMsuYUrx)] -- **Repeat** : 创建一个切片,包含 n 个传入的 item。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Repeat)] - [[play](https://go.dev/play/p/1CbOmtgILUU)] -- **Shuffle** : 随机打乱切片中的元素顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Shuffle)] - [[play](https://go.dev/play/p/YHvhnWGU3Ge)] -- **ShuffleCopy** : 随机打乱切片中的元素顺序, 不改变原切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ShuffleCopy)] - [[play](https://go.dev/play/p/vqDa-Gs1vT0)] -- **IsAscending** : 检查切片元素是否按升序排列。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsAscending)] - [[play](https://go.dev/play/p/9CtsFjet4SH)] -- **IsDescending** : 检查切片元素是否按降序排列。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsDescending)] - [[play](https://go.dev/play/p/U_LljFXma14)] -- **IsSorted** : 检查切片元素是否是有序的(升序或降序)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsSorted)] - [[play](https://go.dev/play/p/nCE8wPLwSA-)] -- **IsSortedByKey** : 通过 iteratee 函数,检查切片元素是否是有序的。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsSortedByKey)] - [[play](https://go.dev/play/p/tUoGB7DOHI4)] -- **Sort** : 对任何有序类型(数字或字符串)的切片进行排序,使用快速排序算法。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Sort)] - [[play](https://go.dev/play/p/V9AVjzf_4Fk)] -- **SortBy** : 按照 less 函数确定的升序规则对切片进行排序。排序不保证稳定性。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#SortBy)] - [[play](https://go.dev/play/p/DAhLQSZEumm)] -- **SortByFielddeprecated** : 按字段对结构切片进行排序。slice 元素应为 struct,字段类型应为 int、uint、string 或 bool。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#SortByField)] - [[play](https://go.dev/play/p/fU1prOBP9p1)] -- **Some** : 如果列表中的任何值通过谓词函数,则返回 true。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Some)] - [[play](https://go.dev/play/p/4pO9Xf9NDGS)] -- **StringSlicedeprecated** : 将接口切片转换为字符串切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#StringSlice)] - [[play](https://go.dev/play/p/W0TZDWCPFcI)] -- **SymmetricDifference** : 返回一个切片,其中的元素存在于参数切片中,但不同时存储在于参数切片中(交集取反)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#h42nJX5xMln)] - [[play](https://go.dev/play/p/1CbOmtgILUU)] -- **ToSlice** : 将可变参数转为切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ToSlice)] - [[play](https://go.dev/play/p/YzbzVq5kscN)] -- **ToSlicePointer** : 将可变参数转为指针切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ToSlicePointer)] - [[play](https://go.dev/play/p/gx4tr6_VXSF)] -- **Unique** : 删除切片中的重复元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Unique)] - [[play](https://go.dev/play/p/AXw0R3ZTE6a)] -- **UniqueBy** : 根据迭代函数返回的值,从输入切片中移除重复元素。此函数保持元素的顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueBy)] - [[play](https://go.dev/play/p/GY7JE4yikrl)] -- **UniqueByComparator** : 使用提供的比较器函数从输入切片中移除重复元素。此函数保持元素的顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByComparator)] - [[play](https://go.dev/play/p/rwSacr-ZHsR)] -- **UniqueByField** : 根据 struct 字段对 struct 切片去重复。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByField)] - [[play](https://go.dev/play/p/6cifcZSPIGu)] -- **UniqueByConcurrent** : 并发的从输入切片中移除重复元素,结果保持元素的顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByConcurrent)] - [[play](https://go.dev/play/p/wXZ7LcYRMGL)] -- **Union** : 合并多个切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Union)] - [[play](https://go.dev/play/p/hfXV1iRIZOf)] -- **UnionBy** : 对切片的每个元素调用函数后,合并多个切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UnionBy)] - [[play](https://go.dev/play/p/HGKHfxKQsFi)] -- **UpdateAt** : 更新索引处的切片元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UpdateAt)] - [[play](https://go.dev/play/p/f3mh2KloWVm)] -- **Without** : 创建一个不包括所有给定值的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Without)] - [[play](https://go.dev/play/p/bwhEXEypThg)] - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#KeyBy)] - [[play](https://go.dev/play/p/uXod2LWD1Kg)] -- **Join** : 用指定的分隔符链接切片元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Join)] - [[play](https://go.dev/play/p/huKzqwNDD7V)] -- **Partition** : 根据给定的 predicate 判断函数分组切片元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Partition)] - [[play](https://go.dev/play/p/lkQ3Ri2NQhV)] -- **Random** : 随机返回切片中元素以及下标, 当切片长度为 0 时返回下标-1。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Random)] - [[play](https://go.dev/play/p/UzpGQptWppw)] -- **SetToDefaultIf** : 根据给定给定的 predicate 判定函数来修改切片中的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#SetToDefaultIf)] - [[play](https://go.dev/play/p/9AXGlPRC0-A)] -- **Break** : 根据判断函数将切片分成两部分。它开始附加到与函数匹配的第一个元素之后的第二个切片。第一个匹配之后的所有元素都包含在第二个切片中,无论它们是否与函数匹配。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Break)] -- **RightPadding** : 在切片的右部添加元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#RightPadding)] - [[play](https://go.dev/play/p/0_2rlLEMBXL)] -- **LeftPadding** : 在切片的左部添加元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#LeftPadding)] - [[play](https://go.dev/play/p/jlQVoelLl2k)] -- **Frequency** : 计算切片中每个元素出现的频率。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Frequency)] - [[play](https://go.dev/play/p/CW3UVNdUZOq)] -- **JoinFunc** : 将切片元素用给定的分隔符连接成一个单一的字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#JoinFunc)] - [[play](https://go.dev/play/p/55ib3SB5fM2)] -- **ConcatBy** : 将切片中的元素连接成一个值,使用指定的分隔符和连接器函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ConcatBy)] - [[play](https://go.dev/play/p/6QcUpcY4UMW)] +- **AppendIfAbsent** : 当前切片中不包含值时,将该值追加到切片中。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#AppendIfAbsent)] + [[play](https://go.dev/play/p/GNdv7Jg2Taj)] +- **Contain** : 判断 slice 是否包含 value。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Contain)] + [[play](https://go.dev/play/p/_454yEHcNjf)] +- **ContainBy** : 根据 predicate 函数判断切片是否包含某个值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ContainBy)] + [[play](https://go.dev/play/p/49tkHfX4GNc)] +- **ContainSubSlice** : 判断 slice 是否包含 subslice。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ContainSubSlice)] + [[play](https://go.dev/play/p/bcuQ3UT6Sev)] +- **ContainAny** : 判断 slice 是否包含 targets 切片中的任意一个元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ContainAny)] + [[play](https://go.dev/play/p/4xoxhc9XSSw)] +- **Chunk** : 按照 size 参数均分 slice。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Chunk)] + [[play](https://go.dev/play/p/b4Pou5j2L_C)] +- **Compact** : 去除 slice 中的假值(false values are false, nil, 0, "")。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Compact)] + [[play](https://go.dev/play/p/pO5AnxEr3TK)] +- **Concat** : 合并多个 slices 到一个 slice 中。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Concat)] + [[play](https://go.dev/play/p/gPt-q7zr5mk)] +- **Count** : 返回切片中指定元素的个数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Count)] + [[play](https://go.dev/play/p/Mj4oiEnQvRJ)] +- **CountBy** : 遍历切片,对每个元素执行函数 predicate. 返回符合函数返回值为 true 的元素的个数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#CountBy)] + [[play](https://go.dev/play/p/tHOccTMDZCC)] +- **Difference** : 创建一个切片,其元素不包含在另一个给定切片中。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Difference)] + [[play](https://go.dev/play/p/VXvadzLzhDa)] +- **DifferenceBy** : 将两个 slice 中的每个元素调用 iteratee 函数,并比较它们的返回值,如果不相等返回在 slice 中对应的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DifferenceBy)] + [[play](https://go.dev/play/p/DiivgwM5OnC)] +- **DifferenceWith** : 接受比较器函数,该比较器被调用以将切片的元素与值进行比较。 结果值的顺序和引用由第一个切片确定。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DifferenceWith)] + [[play](https://go.dev/play/p/v2U2deugKuV)] +- **DeleteAt** : 删除切片中指定索引到的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DeleteAt)] + [[play](https://go.dev/play/p/800B1dPBYyd)] +- **DeleteRange** : 删除切片中指定开始索引到结束索引的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DeleteRange)] + [[play](https://go.dev/play/p/945HwiNrnle)] +- **Drop** : 从切片头部删除 n 个元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Drop)] + [[play](https://go.dev/play/p/jnPO2yQsT8H)] +- **DropRight** : 从切片尾部删除 n 个元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DropRight)] + [[play](https://go.dev/play/p/8bcXvywZezG)] +- **DropWhile** : 从切片的头部删除 n 个元素,这个 n 个元素满足 predicate 函数返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DropWhile)] + [[play](https://go.dev/play/p/4rt252UV_qs)] +- **DropRightWhile** : 从切片的尾部删除 n 个元素,这个 n 个元素满足 predicate 函数返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#DropRightWhile)] + [[play](https://go.dev/play/p/6wyK3zMY56e)] +- **Equal** : 检查两个切片是否相等,相等条件:切片长度相同,元素顺序和值都相同。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Equal)] + [[play](https://go.dev/play/p/WcRQJ37ifPa)] +- **EqualWith** : 检查两个切片是否相等,相等条件:对两个切片的元素调用比较函数 comparator,返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#EqualWith)] + [[play](https://go.dev/play/p/b9iygtgsHI1)] +- **EqualUnordered** : 检查两个切片是否相等,元素数量相同,值相等,不考虑元素顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#EqualUnordered)] + [[play](https://go.dev/play/p/n8fSc2w8ZgX)] +- **Every** : 如果切片中的所有值都通过谓词函数,则返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Every)] + [[play](https://go.dev/play/p/R8U6Sl-j8cD)] +- **Filter** : 返回切片中通过 predicate 函数真值测试的所有元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Filter)] + [[play](https://go.dev/play/p/SdPna-7qK4T)] +- **FilterMap** : 返回一个将 filter 和 map 操作应用于给定切片的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FilterMap)] + [[play](https://go.dev/play/p/J94SZ_9MiIe)] +- **Finddeprecated** : 遍历切片的元素,返回第一个通过 predicate 函数真值测试的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Find)] + [[play](https://go.dev/play/p/CBKeBoHVLgq)] +- **FindBy** : 遍历切片的元素,返回第一个通过 predicate 函数真值测试的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FindBy)] + [[play](https://go.dev/play/p/n1lysBYl-GB)] +- **FindLastdeprecated** : 从头到尾遍历 slice 的元素,返回最后一个通过 predicate 函数真值测试的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FindLast)] + [[play](https://go.dev/play/p/FFDPV_j7URd)] +- **FindLastBy** : 从遍历 slice 的元素,返回最后一个通过 predicate 函数真值测试的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FindLastBy)] + [[play](https://go.dev/play/p/8iqomzyCl_s)] +- **Flatten** : 将多维切片展平一层。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Flatten)] + [[play](https://go.dev/play/p/hYa3cBEevtm)] +- **FlattenDeep** : 将多维切片递归展平到一层。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FlattenDeep)] + [[play](https://go.dev/play/p/yjYNHPyCFaF)] +- **FlatMap** : 将切片转换为其它类型切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#FlatMap)] + [[play](https://go.dev/play/p/_QARWlWs1N_F)] +- **ForEach** : 遍历切片的元素并为每个元素调用 iteratee 函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ForEach)] + [[play](https://go.dev/play/p/DrPaa4YsHRF)] +- **ForEachConcurrent** : 对 slice 并发执行 foreach 操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ForEachConcurrent)] + [[play](https://go.dev/play/p/kT4XW7DKVoV)] +- **ForEachWithBreak** : 遍历切片的元素并为每个元素调用 iteratee 函数,当 iteratee 函数返回 false 时,终止遍历。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ForEachWithBreak)] + [[play](https://go.dev/play/p/qScs39f3D9W)] +- **GroupBy** : 迭代切片的元素,每个元素将按条件分组,返回两个切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#GroupBy)] + [[play](https://go.dev/play/p/QVkPxzPR0iA)] +- **GroupWith** : 创建一个 map,key 是 iteratee 遍历 slice 中的每个元素返回的结果。值是切片元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#GroupWith)] + [[play](https://go.dev/play/p/ApCvMNTLO8a)] +- **IntSlicedeprecated** : 将接口切片转换为 int 切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IntSlice)] + [[play](https://go.dev/play/p/FdQXF0Vvqs-)] +- **InterfaceSlicedeprecated** : 将值转换为 interface 切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#InterfaceSlice)] + [[play](https://go.dev/play/p/FdQXF0Vvqs-)] +- **Intersection** : 返回多个切片的交集。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Intersection)] + [[play](https://go.dev/play/p/anJXfB5wq_t)] +- **InsertAt** : 将元素插入到索引处的切片中。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#InsertAt)] + [[play](https://go.dev/play/p/hMLNxPEGJVE)] +- **IndexOf** : 返回在切片中找到值的第一个匹配项的索引,如果找不到值,则返回-1。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IndexOf)] + [[play](https://go.dev/play/p/MRN1f0FpABb)] +- **LastIndexOf** : 返回在切片中找到最后一个值的索引,如果找不到该值,则返回-1。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#LastIndexOf)] + [[play](https://go.dev/play/p/DokM4cf1IKH)] +- **Map** : 对 slice 中的每个元素执行 map 函数以创建一个新切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Map)] + [[play](https://go.dev/play/p/biaTefqPquw)] +- **MapConcurrent** : 对 slice 并发执行 map 操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#MapConcurrent)] + [[play](https://go.dev/play/p/H1ehfPkPen0)] +- **Merge** : 合并多个切片(不会消除重复元素)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Merge)] + [[play](https://go.dev/play/p/lbjFp784r9N)] +- **Reverse** : 反转切片中的元素顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Reverse)] + [[play](https://go.dev/play/p/8uI8f1lwNrQ)] +- **ReverseCopy** : 反转切片中的元素顺序, 不改变原 slice。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#ReverseCopy)] + [[play](https://go.dev/play/p/c9arEaP7Cg-)] +- **Reducedeprecated** : 将切片中的元素依次运行 iteratee 函数,返回运行结果。(废弃:建议使用 ReduceBy) + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Reduce)] + [[play](https://go.dev/play/p/_RfXJJWIsIm)] +- **ReduceBy** : 对切片元素执行 reduce 操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReduceBy)] + [[play](https://go.dev/play/p/YKDpLi7gtee)] +- **ReduceRight** : 类似 ReduceBy 操作,迭代切片元素顺序从右至左。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReduceRight)] + [[play](https://go.dev/play/p/qT9dZC03A1K)] +- **ReduceConcurrent** : 对切片元素执行并发 reduce 操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReduceConcurrent)] + [[play](https://go.dev/play/p/Tjwe6OtaG07)] +- **Replace** : 返回切片的副本,其中前 n 个不重叠的 old 替换为 new。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Replace)] + [[play](https://go.dev/play/p/P5mZp7IhOFo)] +- **ReplaceAll** : 返回切片的副本,将其中 old 全部替换为 new。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ReplaceAll)] + [[play](https://go.dev/play/p/CzqXMsuYUrx)] +- **Repeat** : 创建一个切片,包含 n 个传入的 item。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Repeat)] + [[play](https://go.dev/play/p/1CbOmtgILUU)] +- **Shuffle** : 随机打乱切片中的元素顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Shuffle)] + [[play](https://go.dev/play/p/YHvhnWGU3Ge)] +- **ShuffleCopy** : 随机打乱切片中的元素顺序, 不改变原切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ShuffleCopy)] + [[play](https://go.dev/play/p/vqDa-Gs1vT0)] +- **IsAscending** : 检查切片元素是否按升序排列。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsAscending)] + [[play](https://go.dev/play/p/9CtsFjet4SH)] +- **IsDescending** : 检查切片元素是否按降序排列。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsDescending)] + [[play](https://go.dev/play/p/U_LljFXma14)] +- **IsSorted** : 检查切片元素是否是有序的(升序或降序)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsSorted)] + [[play](https://go.dev/play/p/nCE8wPLwSA-)] +- **IsSortedByKey** : 通过 iteratee 函数,检查切片元素是否是有序的。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#IsSortedByKey)] + [[play](https://go.dev/play/p/tUoGB7DOHI4)] +- **Sort** : 对任何有序类型(数字或字符串)的切片进行排序,使用快速排序算法。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Sort)] + [[play](https://go.dev/play/p/V9AVjzf_4Fk)] +- **SortBy** : 按照 less 函数确定的升序规则对切片进行排序。排序不保证稳定性。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#SortBy)] + [[play](https://go.dev/play/p/DAhLQSZEumm)] +- **SortByFielddeprecated** : 按字段对结构切片进行排序。slice 元素应为 struct,字段类型应为 int、uint、string 或 bool。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#SortByField)] + [[play](https://go.dev/play/p/fU1prOBP9p1)] +- **Some** : 如果列表中的任何值通过谓词函数,则返回 true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Some)] + [[play](https://go.dev/play/p/4pO9Xf9NDGS)] +- **StringSlicedeprecated** : 将接口切片转换为字符串切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#StringSlice)] + [[play](https://go.dev/play/p/W0TZDWCPFcI)] +- **SymmetricDifference** : 返回一个切片,其中的元素存在于参数切片中,但不同时存储在于参数切片中(交集取反)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#h42nJX5xMln)] + [[play](https://go.dev/play/p/1CbOmtgILUU)] +- **ToSlice** : 将可变参数转为切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ToSlice)] + [[play](https://go.dev/play/p/YzbzVq5kscN)] +- **ToSlicePointer** : 将可变参数转为指针切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ToSlicePointer)] + [[play](https://go.dev/play/p/gx4tr6_VXSF)] +- **Unique** : 删除切片中的重复元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Unique)] + [[play](https://go.dev/play/p/AXw0R3ZTE6a)] +- **UniqueBy** : 根据迭代函数返回的值,从输入切片中移除重复元素。此函数保持元素的顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueBy)] + [[play](https://go.dev/play/p/GY7JE4yikrl)] +- **UniqueByComparator** : 使用提供的比较器函数从输入切片中移除重复元素。此函数保持元素的顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByComparator)] + [[play](https://go.dev/play/p/rwSacr-ZHsR)] +- **UniqueByField** : 根据 struct 字段对 struct 切片去重复。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByField)] + [[play](https://go.dev/play/p/6cifcZSPIGu)] +- **UniqueByConcurrent** : 并发的从输入切片中移除重复元素,结果保持元素的顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByConcurrent)] + [[play](https://go.dev/play/p/wXZ7LcYRMGL)] +- **Union** : 合并多个切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Union)] + [[play](https://go.dev/play/p/hfXV1iRIZOf)] +- **UnionBy** : 对切片的每个元素调用函数后,合并多个切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UnionBy)] + [[play](https://go.dev/play/p/HGKHfxKQsFi)] +- **UpdateAt** : 更新索引处的切片元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UpdateAt)] + [[play](https://go.dev/play/p/f3mh2KloWVm)] +- **Without** : 创建一个不包括所有给定值的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Without)] + [[play](https://go.dev/play/p/bwhEXEypThg)] + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#KeyBy)] + [[play](https://go.dev/play/p/uXod2LWD1Kg)] +- **Join** : 用指定的分隔符链接切片元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Join)] + [[play](https://go.dev/play/p/huKzqwNDD7V)] +- **Partition** : 根据给定的 predicate 判断函数分组切片元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Partition)] + [[play](https://go.dev/play/p/lkQ3Ri2NQhV)] +- **Random** : 随机返回切片中元素以及下标, 当切片长度为 0 时返回下标-1。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Random)] + [[play](https://go.dev/play/p/UzpGQptWppw)] +- **SetToDefaultIf** : 根据给定给定的 predicate 判定函数来修改切片中的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#SetToDefaultIf)] + [[play](https://go.dev/play/p/9AXGlPRC0-A)] +- **Break** : 根据判断函数将切片分成两部分。它开始附加到与函数匹配的第一个元素之后的第二个切片。第一个匹配之后的所有元素都包含在第二个切片中,无论它们是否与函数匹配。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Break)] +- **RightPadding** : 在切片的右部添加元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#RightPadding)] + [[play](https://go.dev/play/p/0_2rlLEMBXL)] +- **LeftPadding** : 在切片的左部添加元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#LeftPadding)] + [[play](https://go.dev/play/p/jlQVoelLl2k)] +- **Frequency** : 计算切片中每个元素出现的频率。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Frequency)] + [[play](https://go.dev/play/p/CW3UVNdUZOq)] +- **JoinFunc** : 将切片元素用给定的分隔符连接成一个单一的字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#JoinFunc)] + [[play](https://go.dev/play/p/55ib3SB5fM2)] +- **ConcatBy** : 将切片中的元素连接成一个值,使用指定的分隔符和连接器函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#ConcatBy)] + [[play](https://go.dev/play/p/6QcUpcY4UMW)]

21. stream 流,该包仅验证简单的 stream 实现,功能有限。       回到目录

@@ -1837,93 +1837,93 @@ import "github.com/duke-git/lancet/v2/stream" #### 函数列表: -- **Of** : 创建元素为指定值的 stream。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Of)] - [[play](https://go.dev/play/p/jI6_iZZuVFE)] -- **FromSlice** : 从切片创建 stream。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FromSlice)] - [[play](https://go.dev/play/p/wywTO0XZtI4)] -- **FromChannel** : 从通道创建 stream。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FromChannel)] - [[play](https://go.dev/play/p/9TZYugGMhXZ)] -- **FromRange** : 指定一个数字范围创建 stream, 范围两端点值都包括在内。. [start, end] - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FromRange)] - [[play](https://go.dev/play/p/9Ex1-zcg-B-)] -- **Generate** : 创建一个 stream,其中每个元素都由提供的生成器函数生成。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Generate)] - [[play](https://go.dev/play/p/rkOWL1yA3j9)] -- **Concat** : 创建一个延迟连接 stream,其元素是第一个 stream 的所有元素,后跟第二个 stream 的全部元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Concat)] - [[play](https://go.dev/play/p/HM4OlYk_OUC)] -- **Distinct** : 创建并返回一个 stream,用于删除重复的项。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Distinct)] - [[play](https://go.dev/play/p/eGkOSrm64cB)] -- **Filter** : 返回一个通过判定函数的 stream。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Filter)] - [[play](https://go.dev/play/p/MFlSANo-buc)] -- **FilterConcurrent** : 对 slice 并发执行 filter 操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FilterConcurrent)] - [[play](https://go.dev/play/p/t_pkwerIRVx)] -- **Map** : 返回一个 stream,该 stream 由将给定函数应用于源 stream 元素的元素组成。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Map)] - [[play](https://go.dev/play/p/OtNQUImdYko)] -- **Peek** : 返回一个由源 stream 的元素组成的 stream,并在从生成的 stream 中消耗元素时对每个元素执行所提供的操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Peek)] - [[play](https://go.dev/play/p/u1VNzHs6cb2)] -- **Skip** : 在丢弃 stream 的前 n 个元素后,返回由源 stream 的其余元素组成的 stream。如果此 stream 包含的元素少于 n 个,则将返回一个空 stream。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Skip)] - [[play](https://go.dev/play/p/fNdHbqjahum)] -- **Limit** : 返回由源 stream 的元素组成的 stream,该 stream 被截断为长度不超过 maxSize。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Limit)] - [[play](https://go.dev/play/p/qsO4aniDcGf)] -- **Reverse** : 返回元素与源 stream 的顺序相反的 stream。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Reverse)] - [[play](https://go.dev/play/p/A8_zkJnLHm4)] -- **Range** : 返回一个 stream,该 stream 的元素在从源 stream 的开始(包含)到结束(排除)的范围内。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Range)] - [[play](https://go.dev/play/p/indZY5V2f4j)] -- **Sorted** : 返回一个 stream,该 stream 由源 stream 的元素组成,并根据提供的 less 函数进行排序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Sorted)] - [[play](https://go.dev/play/p/XXtng5uonFj)] -- **ForEach** : 对 stream 的每个元素执行一个操作。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#ForEach)] - [[play](https://go.dev/play/p/Dsm0fPqcidk)] -- **Reduce** : 使用关联累加函数对 stream 的元素执行 reduce 操作,并 reduce 操作结果(如果有)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Reduce)] - [[play](https://go.dev/play/p/6uzZjq_DJLU)] -- **FindFirst** : 返回此 stream 的第一个元素,如果 stream 为空,则返回零值和 false。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FindFirst)] - [[play](https://go.dev/play/p/9xEf0-6C1e3)] -- **FindLast** : 返回此 stream 的最后一个元素,如果 stream 为空,则返回零值和 false。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FindLast)] - [[play](https://go.dev/play/p/WZD2rDAW-2h)] -- **Max** : 根据提供的 less 函数返回 stream 的最大元素。less 函数: a > b - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Max)] - [[play](https://go.dev/play/p/fm-1KOPtGzn)] -- **Min** : 根据提供的 less 函数返回 stream 的最小元素。less 函数: a < b - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Min)] - [[play](https://go.dev/play/p/vZfIDgGNRe_0)] -- **AllMatch** : 判断 stream 的所有元素是否全部匹配指定判定函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#AllMatch)] - [[play](https://go.dev/play/p/V5TBpVRs-Cx)] -- **AnyMatch** : 判断 stream 是否包含匹配指定判定函数的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#AnyMatch)] - [[play](https://go.dev/play/p/PTCnWn4OxSn)] -- **NoneMatch** : 判断 stream 的元素是否全部不匹配指定的判定函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#NoneMatch)] - [[play](https://go.dev/play/p/iWS64pL1oo3)] -- **Count** : 返回 stream 中元素的数量。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Count)] - [[play](https://go.dev/play/p/r3koY6y_Xo-)] -- **ToSlice** : 返回 stream 中的元素切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#ToSlice)] - [[play](https://go.dev/play/p/jI6_iZZuVFE)] -- **IndexOf** : 返回在 stream 中找到值的第一个匹配项的索引,如果找不到值,则返回-1。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#IndexOf)] - [[play](https://go.dev/play/p/tBV5Nc-XDX2)] -- **LastIndexOf** : 返回在 stream 中找到值的最后一个匹配项的索引,如果找不到值,则返回-1。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#LastIndexOf)] - [[play](https://go.dev/play/p/CjeoNw2eac_G)] +- **Of** : 创建元素为指定值的 stream。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Of)] + [[play](https://go.dev/play/p/jI6_iZZuVFE)] +- **FromSlice** : 从切片创建 stream。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FromSlice)] + [[play](https://go.dev/play/p/wywTO0XZtI4)] +- **FromChannel** : 从通道创建 stream。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FromChannel)] + [[play](https://go.dev/play/p/9TZYugGMhXZ)] +- **FromRange** : 指定一个数字范围创建 stream, 范围两端点值都包括在内。. [start, end] + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FromRange)] + [[play](https://go.dev/play/p/9Ex1-zcg-B-)] +- **Generate** : 创建一个 stream,其中每个元素都由提供的生成器函数生成。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Generate)] + [[play](https://go.dev/play/p/rkOWL1yA3j9)] +- **Concat** : 创建一个延迟连接 stream,其元素是第一个 stream 的所有元素,后跟第二个 stream 的全部元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Concat)] + [[play](https://go.dev/play/p/HM4OlYk_OUC)] +- **Distinct** : 创建并返回一个 stream,用于删除重复的项。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Distinct)] + [[play](https://go.dev/play/p/eGkOSrm64cB)] +- **Filter** : 返回一个通过判定函数的 stream。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Filter)] + [[play](https://go.dev/play/p/MFlSANo-buc)] +- **FilterConcurrent** : 对 slice 并发执行 filter 操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FilterConcurrent)] + [[play](https://go.dev/play/p/t_pkwerIRVx)] +- **Map** : 返回一个 stream,该 stream 由将给定函数应用于源 stream 元素的元素组成。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Map)] + [[play](https://go.dev/play/p/OtNQUImdYko)] +- **Peek** : 返回一个由源 stream 的元素组成的 stream,并在从生成的 stream 中消耗元素时对每个元素执行所提供的操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Peek)] + [[play](https://go.dev/play/p/u1VNzHs6cb2)] +- **Skip** : 在丢弃 stream 的前 n 个元素后,返回由源 stream 的其余元素组成的 stream。如果此 stream 包含的元素少于 n 个,则将返回一个空 stream。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Skip)] + [[play](https://go.dev/play/p/fNdHbqjahum)] +- **Limit** : 返回由源 stream 的元素组成的 stream,该 stream 被截断为长度不超过 maxSize。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Limit)] + [[play](https://go.dev/play/p/qsO4aniDcGf)] +- **Reverse** : 返回元素与源 stream 的顺序相反的 stream。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Reverse)] + [[play](https://go.dev/play/p/A8_zkJnLHm4)] +- **Range** : 返回一个 stream,该 stream 的元素在从源 stream 的开始(包含)到结束(排除)的范围内。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Range)] + [[play](https://go.dev/play/p/indZY5V2f4j)] +- **Sorted** : 返回一个 stream,该 stream 由源 stream 的元素组成,并根据提供的 less 函数进行排序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Sorted)] + [[play](https://go.dev/play/p/XXtng5uonFj)] +- **ForEach** : 对 stream 的每个元素执行一个操作。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#ForEach)] + [[play](https://go.dev/play/p/Dsm0fPqcidk)] +- **Reduce** : 使用关联累加函数对 stream 的元素执行 reduce 操作,并 reduce 操作结果(如果有)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Reduce)] + [[play](https://go.dev/play/p/6uzZjq_DJLU)] +- **FindFirst** : 返回此 stream 的第一个元素,如果 stream 为空,则返回零值和 false。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FindFirst)] + [[play](https://go.dev/play/p/9xEf0-6C1e3)] +- **FindLast** : 返回此 stream 的最后一个元素,如果 stream 为空,则返回零值和 false。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#FindLast)] + [[play](https://go.dev/play/p/WZD2rDAW-2h)] +- **Max** : 根据提供的 less 函数返回 stream 的最大元素。less 函数: a > b + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Max)] + [[play](https://go.dev/play/p/fm-1KOPtGzn)] +- **Min** : 根据提供的 less 函数返回 stream 的最小元素。less 函数: a < b + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Min)] + [[play](https://go.dev/play/p/vZfIDgGNRe_0)] +- **AllMatch** : 判断 stream 的所有元素是否全部匹配指定判定函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#AllMatch)] + [[play](https://go.dev/play/p/V5TBpVRs-Cx)] +- **AnyMatch** : 判断 stream 是否包含匹配指定判定函数的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#AnyMatch)] + [[play](https://go.dev/play/p/PTCnWn4OxSn)] +- **NoneMatch** : 判断 stream 的元素是否全部不匹配指定的判定函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#NoneMatch)] + [[play](https://go.dev/play/p/iWS64pL1oo3)] +- **Count** : 返回 stream 中元素的数量。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#Count)] + [[play](https://go.dev/play/p/r3koY6y_Xo-)] +- **ToSlice** : 返回 stream 中的元素切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#ToSlice)] + [[play](https://go.dev/play/p/jI6_iZZuVFE)] +- **IndexOf** : 返回在 stream 中找到值的第一个匹配项的索引,如果找不到值,则返回-1。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#IndexOf)] + [[play](https://go.dev/play/p/tBV5Nc-XDX2)] +- **LastIndexOf** : 返回在 stream 中找到值的最后一个匹配项的索引,如果找不到值,则返回-1。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/stream.md#LastIndexOf)] + [[play](https://go.dev/play/p/CjeoNw2eac_G)]

22. structs 提供操作 struct, tag, field 的相关函数。       回到目录

@@ -1933,51 +1933,51 @@ import "github.com/duke-git/lancet/v2/structs" #### 函数列表: -- **New** : `Struct`结构体的构造函数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#New)] - [[play](https://go.dev/play/p/O29l8kk-Z17)] -- **ToMap** : 将一个合法的 struct 对象转换为 map[string]any。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#ToMap)] - [[play](https://go.dev/play/p/qQbLySBgerZ)] -- **Fields** : 获取一个 struct 对象的属性列表。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Fields)] - [[play](https://go.dev/play/p/w3Kk_CyVY7D)] -- **Field** : 根据属性名获取一个 struct 对象的属性。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Fields)] - [[play](https://go.dev/play/p/KocZMSYarza)] -- **IsStruct** : 判断是否为一个合法的 struct 对象。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsStruct)] - [[play](https://go.dev/play/p/bU2FSdkbK1C)] -- **Tag** : 获取`Field`的`Tag`,默认的 tag key 是 json。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Tag)] - [[play](https://go.dev/play/p/DVrx5HvvUJr)] -- **Name** : 获取属性名。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Name)] - [[play](https://go.dev/play/p/zfIGlqsatee)] -- **Value** : 获取`Field`属性的值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Value)] - [[play](https://go.dev/play/p/qufYEU2o4Oi)] -- **Kind** : 获取属性 Kind。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Kind)] - [[play](https://go.dev/play/p/wg4NlcUNG5o)] -- **IsEmbedded** : 判断属性是否为嵌入。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsEmbedded)] - [[play](https://go.dev/play/p/wV2PrbYm3Ec)] -- **IsExported** : 判断属性是否导出。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsExported)] - [[play](https://go.dev/play/p/csK4AXYaNbJ)] -- **IsZero** : 判断属性是否为零值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsZero)] - [[play](https://go.dev/play/p/RzqpGISf87r)] -- **IsSlice** : 判断属性是否是切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsSlice)] - [[play](https://go.dev/play/p/MKz4CgBIUrU)] -- **IsTargetType** : 判断属性是否是目标类型。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsTargetType)] - [[play](https://go.dev/play/p/Ig75P-agN39)] -- **TypeName** : 获取结构体类型名。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#TypeName)] - [[play](https://go.dev/play/p/SWLWd0XBaBb)] +- **New** : `Struct`结构体的构造函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#New)] + [[play](https://go.dev/play/p/O29l8kk-Z17)] +- **ToMap** : 将一个合法的 struct 对象转换为 map[string]any。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#ToMap)] + [[play](https://go.dev/play/p/qQbLySBgerZ)] +- **Fields** : 获取一个 struct 对象的属性列表。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Fields)] + [[play](https://go.dev/play/p/w3Kk_CyVY7D)] +- **Field** : 根据属性名获取一个 struct 对象的属性。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Fields)] + [[play](https://go.dev/play/p/KocZMSYarza)] +- **IsStruct** : 判断是否为一个合法的 struct 对象。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsStruct)] + [[play](https://go.dev/play/p/bU2FSdkbK1C)] +- **Tag** : 获取`Field`的`Tag`,默认的 tag key 是 json。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Tag)] + [[play](https://go.dev/play/p/DVrx5HvvUJr)] +- **Name** : 获取属性名。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Name)] + [[play](https://go.dev/play/p/zfIGlqsatee)] +- **Value** : 获取`Field`属性的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Value)] + [[play](https://go.dev/play/p/qufYEU2o4Oi)] +- **Kind** : 获取属性 Kind。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#Kind)] + [[play](https://go.dev/play/p/wg4NlcUNG5o)] +- **IsEmbedded** : 判断属性是否为嵌入。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsEmbedded)] + [[play](https://go.dev/play/p/wV2PrbYm3Ec)] +- **IsExported** : 判断属性是否导出。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsExported)] + [[play](https://go.dev/play/p/csK4AXYaNbJ)] +- **IsZero** : 判断属性是否为零值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsZero)] + [[play](https://go.dev/play/p/RzqpGISf87r)] +- **IsSlice** : 判断属性是否是切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsSlice)] + [[play](https://go.dev/play/p/MKz4CgBIUrU)] +- **IsTargetType** : 判断属性是否是目标类型。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#IsTargetType)] + [[play](https://go.dev/play/p/Ig75P-agN39)] +- **TypeName** : 获取结构体类型名。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/struct.md#TypeName)] + [[play](https://go.dev/play/p/SWLWd0XBaBb)]

23. strutil 包含字符串处理的相关函数。       回到目录

@@ -1987,153 +1987,153 @@ import "github.com/duke-git/lancet/v2/strutil" #### 函数列表: -- **After** : 返回源字符串中指定字符串首次出现时的位置之后的子字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#After)] - [[play](https://go.dev/play/p/RbCOQqCDA7m)] -- **AfterLast** : 返回源字符串中指定字符串最后一次出现时的位置之后的子字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#AfterLast)] - [[play](https://go.dev/play/p/1TegARrb8Yn)] -- **Before** : 返回源字符串中指定字符串第一次出现时的位置之前的子字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Before)] - [[play](https://go.dev/play/p/JAWTZDS4F5w)] -- **BeforeLast** : 返回源字符串中指定字符串最后一次出现时的位置之前的子字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#BeforeLast)] - [[play](https://go.dev/play/p/pJfXXAoG_Te)] -- **CamelCase** : 将字符串转换为camelCase驼峰式字符串, 非字母和数字会被忽略。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#CamelCase)] - [[play](https://go.dev/play/p/9eXP3tn2tUy)] -- **UpperCamelCase** : 将字符串转换为CamelCase大写驼峰式字符串, 非字母和数字会被忽略。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperCamelCase)] - [[play](https://go.dev/play/p/vPHszjTXSFp)] -- **Capitalize** : 将字符串的第一个字符转换为大写。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Capitalize)] - [[play](https://go.dev/play/p/2OAjgbmAqHZ)] -- **ContainsAll** : 判断字符串是否包括全部给定的子字符串切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ContainsAll)] - [[play](https://go.dev/play/p/KECtK2Os4zq)] -- **ContainsAny** : 判断字符串是否包括给定的子字符串切片中任意一个子字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ContainsAny)] - [[play](https://go.dev/play/p/dZGSSMB3LXE)] -- **IsString** : 判断传入参数的数据类型是否为字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IsString)] - [[play](https://go.dev/play/p/IOgq7oF9ERm)] -- **KebabCase** : 将字符串转换为 kebab-case 形式字符串, 非字母和数字会被忽略。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#KebabCase)] - [[play](https://go.dev/play/p/dcZM9Oahw-Y)] -- **UpperKebabCase** : 将字符串转换为大写 KEBAB-CASE 形式字符串, 非字母和数字会被忽略。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperKebabCase)] - [[play](https://go.dev/play/p/zDyKNneyQXk)] -- **LowerFirst** : 将字符串的第一个字符转换为小写形式。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#LowerFirst)] - [[play](https://go.dev/play/p/CbzAyZmtJwL)] -- **UpperFirst** : 将字符串的第一个字符转换为大写形式。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperFirst)] - [[play](https://go.dev/play/p/sBbBxRbs8MM)] -- **Pad** : 如果字符串长度短于 size,则在左右两侧填充字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Pad)] - [[play](https://go.dev/play/p/NzImQq-VF8q)] -- **PadEnd** : 如果字符串短于限制大小,则在右侧用给定字符填充字符串。 如果填充字符超出大小,它们将被截断。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#PadEnd)] - [[play](https://go.dev/play/p/9xP8rN0vz--)] -- **PadStart** : 如果字符串短于限制大小,则在左侧用给定字符填充字符串。 如果填充字符超出大小,它们将被截断。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#PadStart)] - [[play](https://go.dev/play/p/xpTfzArDfvT)] -- **Reverse** : 返回字符顺序与给定字符串相反的字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Reverse)] - [[play](https://go.dev/play/p/adfwalJiecD)] -- **SnakeCase** : 将字符串转换为 snake_case 形式, 非字母和数字会被忽略。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SnakeCase)] - [[play](https://go.dev/play/p/tgzQG11qBuN)] -- **UpperSnakeCase** : 将字符串转换为大写 SNAKE_CASE 形式, 非字母和数字会被忽略。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperSnakeCase)] - [[play](https://go.dev/play/p/4COPHpnLx38)] -- **SplitEx** : 拆分给定的字符串可以控制结果切片是否包含空字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SplitEx)] - [[play](https://go.dev/play/p/Us-ySSbWh-3)] -- **Substring** : 根据指定的位置和长度截取子字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Substring)] - [[play](https://go.dev/play/p/q3sM6ehnPDp)] -- **Wrap** : 用给定字符包裹传入的字符串 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Wrap)] - [[play](https://go.dev/play/p/KoZOlZDDt9y)] -- **Unwrap** : 从另一个字符串中解开一个给定的字符串。 将更改源字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Unwrap)] - [[play](https://go.dev/play/p/Ec2q4BzCpG-)] -- **SplitWords** : 将字符串拆分为单词,只支持字母字符单词。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SplitWords)] - [[play](https://go.dev/play/p/KLiX4WiysMM)] -- **WordCount** : 返回有意义单词的数量,只支持字母字符单词。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#WordCount)] - [[play](https://go.dev/play/p/bj7_odx3vRf)] -- **RemoveNonPrintable** : 删除字符串中不可打印的字符。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#RemoveNonPrintable)] - [[play](https://go.dev/play/p/og47F5x_jTZ)] -- **StringToBytes** : 在不分配内存的情况下将字符串转换为字节片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#StringToBytes)] - [[play](https://go.dev/play/p/7OyFBrf9AxA)] -- **BytesToString** : 在不分配内存的情况下将字节切片转换为字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#BytesToString)] - [[play](https://go.dev/play/p/6c68HRvJecH)] -- **IsBlank** : 检查字符串是否为空格或空。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IsBlank)] - [[play](https://go.dev/play/p/6zXRH_c0Qd3)] -- **IsNotBlank** : 检查字符串是否不为空。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IsNotBlank)] - [[play](https://go.dev/play/p/e_oJW0RAquA)] -- **HasPrefixAny** : 检查字符串是否以指定字符串数组中的任何一个开头。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HasPrefixAny)] - [[play](https://go.dev/play/p/8UUTl2C5slo)] -- **HasSuffixAny** : 检查字符串是否以指定字符串数组中的任何一个结尾。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HasSuffixAny)] - [[play](https://go.dev/play/p/sKWpCQdOVkx)] -- **IndexOffset** : 将字符串偏移 idxFrom 后,返回字符串中第一个 substr 实例的索引。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IndexOffset)] - [[play](https://go.dev/play/p/qZo4lV2fomB)] -- **ReplaceWithMap** : 返回 string 的副本,以无序的方式被 map 替换,区分大小写。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ReplaceWithMap)] - [[play](https://go.dev/play/p/h3t7CNj2Vvu)] -- **Trim** : 从字符串的开头和结尾去除空格(或其他字符)。 可选参数 characterMask 指定额外的剥离字符。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Trim)] - [[play](https://go.dev/play/p/Y0ilP0NRV3j)] -- **SplitAndTrim** : 将字符串 str 按字符串 delimiter 拆分为一个切片,并对该数组的每个元素调用 Trim。忽略 Trim 后为空的元素。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SplitAndTrim)] - [[play](https://go.dev/play/p/ZNL6o4SkYQ7)] -- **HideString** : 隐藏源字符串中的一些字符。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HideString)] - [[play](https://go.dev/play/p/pzbaIVCTreZ)] -- **RemoveWhiteSpace** : 删除字符串中的空格。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#RemoveWhiteSpace)] - [[play](https://go.dev/play/p/HzLC9vsTwkf)] -- **SubInBetween** : 获取字符串中指定的起始字符串 start 和终止字符串 end 直接的子字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SubInBetween)] - [[play](https://go.dev/play/p/EDbaRvjeNsv)] -- **HammingDistance** : 计算两个字符串之间的汉明距离。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HammingDistance)] - [[play](https://go.dev/play/p/glNdQEA9HUi)] -- **Concat** : 拼接字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Concat)] - [[play](https://go.dev/play/p/gD52SZHr4Kp)] -- **Ellipsis** : 将字符串截断到指定长度,并在末尾添加省略号。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Ellipsis)] - [[play](https://go.dev/play/p/i1vbdQiQVRR)] -- **Shuffle** : 打乱给定字符串中的字符顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Shuffle)] - [[play](https://go.dev/play/p/iStFwBwyGY7)] -- **Rotate** : 按指定的字符数旋转字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Rotate)] - [[play](https://go.dev/play/p/Kf03iOeT5bd)] -- **TemplateReplace** : 将模板字符串中的占位符替换为 map 中的相应值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#TemplateReplace)] - [[play](https://go.dev/play/p/cXSuFvyZqv9)] -- **RegexMatchAllGroups** : 使用正则表达式匹配字符串中的所有子组并返回结果。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#RegexMatchAllGroups)] - [[play](https://go.dev/play/p/JZiu0RXpgN-)] -- **ExtractContent** : 提取两个标记之间的内容。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ExtractContent)] - [[play](https://go.dev/play/p/Ay9UIk7Rum9)] -- **FindAllOccurrences** : 返回子字符串在字符串中所有出现的位置。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#FindAllOccurrences)] - [[play](https://go.dev/play/p/uvyA6azGLB1)] +- **After** : 返回源字符串中指定字符串首次出现时的位置之后的子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#After)] + [[play](https://go.dev/play/p/RbCOQqCDA7m)] +- **AfterLast** : 返回源字符串中指定字符串最后一次出现时的位置之后的子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#AfterLast)] + [[play](https://go.dev/play/p/1TegARrb8Yn)] +- **Before** : 返回源字符串中指定字符串第一次出现时的位置之前的子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Before)] + [[play](https://go.dev/play/p/JAWTZDS4F5w)] +- **BeforeLast** : 返回源字符串中指定字符串最后一次出现时的位置之前的子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#BeforeLast)] + [[play](https://go.dev/play/p/pJfXXAoG_Te)] +- **CamelCase** : 将字符串转换为camelCase驼峰式字符串, 非字母和数字会被忽略。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#CamelCase)] + [[play](https://go.dev/play/p/9eXP3tn2tUy)] +- **UpperCamelCase** : 将字符串转换为CamelCase大写驼峰式字符串, 非字母和数字会被忽略。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperCamelCase)] + [[play](https://go.dev/play/p/vPHszjTXSFp)] +- **Capitalize** : 将字符串的第一个字符转换为大写。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Capitalize)] + [[play](https://go.dev/play/p/2OAjgbmAqHZ)] +- **ContainsAll** : 判断字符串是否包括全部给定的子字符串切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ContainsAll)] + [[play](https://go.dev/play/p/KECtK2Os4zq)] +- **ContainsAny** : 判断字符串是否包括给定的子字符串切片中任意一个子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ContainsAny)] + [[play](https://go.dev/play/p/dZGSSMB3LXE)] +- **IsString** : 判断传入参数的数据类型是否为字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IsString)] + [[play](https://go.dev/play/p/IOgq7oF9ERm)] +- **KebabCase** : 将字符串转换为 kebab-case 形式字符串, 非字母和数字会被忽略。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#KebabCase)] + [[play](https://go.dev/play/p/dcZM9Oahw-Y)] +- **UpperKebabCase** : 将字符串转换为大写 KEBAB-CASE 形式字符串, 非字母和数字会被忽略。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperKebabCase)] + [[play](https://go.dev/play/p/zDyKNneyQXk)] +- **LowerFirst** : 将字符串的第一个字符转换为小写形式。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#LowerFirst)] + [[play](https://go.dev/play/p/CbzAyZmtJwL)] +- **UpperFirst** : 将字符串的第一个字符转换为大写形式。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperFirst)] + [[play](https://go.dev/play/p/sBbBxRbs8MM)] +- **Pad** : 如果字符串长度短于 size,则在左右两侧填充字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Pad)] + [[play](https://go.dev/play/p/NzImQq-VF8q)] +- **PadEnd** : 如果字符串短于限制大小,则在右侧用给定字符填充字符串。 如果填充字符超出大小,它们将被截断。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#PadEnd)] + [[play](https://go.dev/play/p/9xP8rN0vz--)] +- **PadStart** : 如果字符串短于限制大小,则在左侧用给定字符填充字符串。 如果填充字符超出大小,它们将被截断。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#PadStart)] + [[play](https://go.dev/play/p/xpTfzArDfvT)] +- **Reverse** : 返回字符顺序与给定字符串相反的字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Reverse)] + [[play](https://go.dev/play/p/adfwalJiecD)] +- **SnakeCase** : 将字符串转换为 snake_case 形式, 非字母和数字会被忽略。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SnakeCase)] + [[play](https://go.dev/play/p/tgzQG11qBuN)] +- **UpperSnakeCase** : 将字符串转换为大写 SNAKE_CASE 形式, 非字母和数字会被忽略。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperSnakeCase)] + [[play](https://go.dev/play/p/4COPHpnLx38)] +- **SplitEx** : 拆分给定的字符串可以控制结果切片是否包含空字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SplitEx)] + [[play](https://go.dev/play/p/Us-ySSbWh-3)] +- **Substring** : 根据指定的位置和长度截取子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Substring)] + [[play](https://go.dev/play/p/q3sM6ehnPDp)] +- **Wrap** : 用给定字符包裹传入的字符串 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Wrap)] + [[play](https://go.dev/play/p/KoZOlZDDt9y)] +- **Unwrap** : 从另一个字符串中解开一个给定的字符串。 将更改源字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Unwrap)] + [[play](https://go.dev/play/p/Ec2q4BzCpG-)] +- **SplitWords** : 将字符串拆分为单词,只支持字母字符单词。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SplitWords)] + [[play](https://go.dev/play/p/KLiX4WiysMM)] +- **WordCount** : 返回有意义单词的数量,只支持字母字符单词。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#WordCount)] + [[play](https://go.dev/play/p/bj7_odx3vRf)] +- **RemoveNonPrintable** : 删除字符串中不可打印的字符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#RemoveNonPrintable)] + [[play](https://go.dev/play/p/og47F5x_jTZ)] +- **StringToBytes** : 在不分配内存的情况下将字符串转换为字节片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#StringToBytes)] + [[play](https://go.dev/play/p/7OyFBrf9AxA)] +- **BytesToString** : 在不分配内存的情况下将字节切片转换为字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#BytesToString)] + [[play](https://go.dev/play/p/6c68HRvJecH)] +- **IsBlank** : 检查字符串是否为空格或空。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IsBlank)] + [[play](https://go.dev/play/p/6zXRH_c0Qd3)] +- **IsNotBlank** : 检查字符串是否不为空。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IsNotBlank)] + [[play](https://go.dev/play/p/e_oJW0RAquA)] +- **HasPrefixAny** : 检查字符串是否以指定字符串数组中的任何一个开头。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HasPrefixAny)] + [[play](https://go.dev/play/p/8UUTl2C5slo)] +- **HasSuffixAny** : 检查字符串是否以指定字符串数组中的任何一个结尾。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HasSuffixAny)] + [[play](https://go.dev/play/p/sKWpCQdOVkx)] +- **IndexOffset** : 将字符串偏移 idxFrom 后,返回字符串中第一个 substr 实例的索引。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#IndexOffset)] + [[play](https://go.dev/play/p/qZo4lV2fomB)] +- **ReplaceWithMap** : 返回 string 的副本,以无序的方式被 map 替换,区分大小写。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ReplaceWithMap)] + [[play](https://go.dev/play/p/h3t7CNj2Vvu)] +- **Trim** : 从字符串的开头和结尾去除空格(或其他字符)。 可选参数 characterMask 指定额外的剥离字符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Trim)] + [[play](https://go.dev/play/p/Y0ilP0NRV3j)] +- **SplitAndTrim** : 将字符串 str 按字符串 delimiter 拆分为一个切片,并对该数组的每个元素调用 Trim。忽略 Trim 后为空的元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SplitAndTrim)] + [[play](https://go.dev/play/p/ZNL6o4SkYQ7)] +- **HideString** : 隐藏源字符串中的一些字符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HideString)] + [[play](https://go.dev/play/p/pzbaIVCTreZ)] +- **RemoveWhiteSpace** : 删除字符串中的空格。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#RemoveWhiteSpace)] + [[play](https://go.dev/play/p/HzLC9vsTwkf)] +- **SubInBetween** : 获取字符串中指定的起始字符串 start 和终止字符串 end 直接的子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#SubInBetween)] + [[play](https://go.dev/play/p/EDbaRvjeNsv)] +- **HammingDistance** : 计算两个字符串之间的汉明距离。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#HammingDistance)] + [[play](https://go.dev/play/p/glNdQEA9HUi)] +- **Concat** : 拼接字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Concat)] + [[play](https://go.dev/play/p/gD52SZHr4Kp)] +- **Ellipsis** : 将字符串截断到指定长度,并在末尾添加省略号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Ellipsis)] + [[play](https://go.dev/play/p/i1vbdQiQVRR)] +- **Shuffle** : 打乱给定字符串中的字符顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Shuffle)] + [[play](https://go.dev/play/p/iStFwBwyGY7)] +- **Rotate** : 按指定的字符数旋转字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Rotate)] + [[play](https://go.dev/play/p/Kf03iOeT5bd)] +- **TemplateReplace** : 将模板字符串中的占位符替换为 map 中的相应值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#TemplateReplace)] + [[play](https://go.dev/play/p/cXSuFvyZqv9)] +- **RegexMatchAllGroups** : 使用正则表达式匹配字符串中的所有子组并返回结果。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#RegexMatchAllGroups)] + [[play](https://go.dev/play/p/JZiu0RXpgN-)] +- **ExtractContent** : 提取两个标记之间的内容。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#ExtractContent)] + [[play](https://go.dev/play/p/Ay9UIk7Rum9)] +- **FindAllOccurrences** : 返回子字符串在字符串中所有出现的位置。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#FindAllOccurrences)] + [[play](https://go.dev/play/p/uvyA6azGLB1)]

24. system 包含 os, runtime, shell command 的相关函数。       回到目录

@@ -2143,45 +2143,45 @@ import "github.com/duke-git/lancet/v2/system" #### 函数列表: -- **IsWindows** : 检查当前操作系统是否是 windows。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#IsWindows)] - [[play](https://go.dev/play/p/XzJULbzmf9m)] -- **IsLinux** : 检查当前操作系统是否是 linux。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#IsLinux)] - [[play](https://go.dev/play/p/zIflQgZNuxD)] -- **IsMac** : 检查当前操作系统是否是 macos。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#IsMac)] - [[play](https://go.dev/play/p/Mg4Hjtyq7Zc)] -- **GetOsEnv** : 根据 key 获取对应的环境变量值 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#GetOsEnv)] - [[play](https://go.dev/play/p/D88OYVCyjO-)] -- **SetOsEnv** : 设置环境变量。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#SetOsEnv)] - [[play](https://go.dev/play/p/D88OYVCyjO-)] -- **RemoveOsEnv** : 删除环境变量。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#RemoveOsEnv)] - [[play](https://go.dev/play/p/fqyq4b3xUFQ)] -- **CompareOsEnv** : 换取环境变量并与传入值进行比较。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#CompareOsEnv)] - [[play](https://go.dev/play/p/BciHrKYOHbp)] -- **ExecCommand** : 执行 shell 命令。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#ExecCommand)] - [[play](https://go.dev/play/p/n-2fLyZef-4)] -- **GetOsBits** : 获取当前操作系统位数(32/64)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#GetOsBits)] - [[play](https://go.dev/play/p/ml-_XH3gJbW)] -- **StartProcess** :创建进程。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#StartProcess)] - [[play](https://go.dev/play/p/5GVol6ryS_X)] -- **StopProcess** : 停止进程。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#StopProcess)] - [[play](https://go.dev/play/p/jJZhRYGGcmD)] -- **KillProcess** : 杀掉进程。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#KillProcess)] - [[play](https://go.dev/play/p/XKmvV-ExBWa)] -- **GetProcessInfo** : 根据进程 id 获取进程信息。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#GetProcessInfo)] - [[play](https://go.dev/play/p/NQDVywEYYx7)] +- **IsWindows** : 检查当前操作系统是否是 windows。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#IsWindows)] + [[play](https://go.dev/play/p/XzJULbzmf9m)] +- **IsLinux** : 检查当前操作系统是否是 linux。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#IsLinux)] + [[play](https://go.dev/play/p/zIflQgZNuxD)] +- **IsMac** : 检查当前操作系统是否是 macos。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#IsMac)] + [[play](https://go.dev/play/p/Mg4Hjtyq7Zc)] +- **GetOsEnv** : 根据 key 获取对应的环境变量值 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#GetOsEnv)] + [[play](https://go.dev/play/p/D88OYVCyjO-)] +- **SetOsEnv** : 设置环境变量。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#SetOsEnv)] + [[play](https://go.dev/play/p/D88OYVCyjO-)] +- **RemoveOsEnv** : 删除环境变量。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#RemoveOsEnv)] + [[play](https://go.dev/play/p/fqyq4b3xUFQ)] +- **CompareOsEnv** : 换取环境变量并与传入值进行比较。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#CompareOsEnv)] + [[play](https://go.dev/play/p/BciHrKYOHbp)] +- **ExecCommand** : 执行 shell 命令。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#ExecCommand)] + [[play](https://go.dev/play/p/n-2fLyZef-4)] +- **GetOsBits** : 获取当前操作系统位数(32/64)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system#GetOsBits)] + [[play](https://go.dev/play/p/ml-_XH3gJbW)] +- **StartProcess** :创建进程。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#StartProcess)] + [[play](https://go.dev/play/p/5GVol6ryS_X)] +- **StopProcess** : 停止进程。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#StopProcess)] + [[play](https://go.dev/play/p/jJZhRYGGcmD)] +- **KillProcess** : 杀掉进程。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#KillProcess)] + [[play](https://go.dev/play/p/XKmvV-ExBWa)] +- **GetProcessInfo** : 根据进程 id 获取进程信息。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/system.md#GetProcessInfo)] + [[play](https://go.dev/play/p/NQDVywEYYx7)]

25. Tuple 包实现一个元组数据类型。       回到目录

@@ -2191,114 +2191,114 @@ import "github.com/duke-git/lancet/v2/tuple" #### 函数列表: -- **Tuple2** : 2 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple2)] - [[play](https://go.dev/play/p/3sHVqBQpLYN)] -- **Tuple2_Unbox** : 返回 2 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple2_Unbox)] - [[play](https://go.dev/play/p/0fD1qfCVwjm)] -- **Zip2** : 创建一个 Tuple2 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip2)] - [[play](https://go.dev/play/p/4ncWJJ77Xio)] -- **Unzip2** : 根据传入的 Tuple2 切片,创建一组和 Tuple2 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip2)] - [[play](https://go.dev/play/p/KBecr60feXb)] -- **Tuple3** : 3 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple3)] - [[play](https://go.dev/play/p/FtH2sdCLlCf)] -- **Tuple3_Unbox** : 返回 3 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple3_Unbox)] - [[play](https://go.dev/play/p/YojLy-id1BS)] -- **Zip3** : 创建一个 Tuple3 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip3)] - [[play](https://go.dev/play/p/97NgmsTILfu)] -- **Unzip3** : 根据传入的 Tuple3 切片,创建一组和 Tuple3 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip3)] - [[play](https://go.dev/play/p/bba4cpAa7KO)] -- **Tuple4** : 4 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple4)] - [[play](https://go.dev/play/p/D2EqDz096tk)] -- **Tuple4_Unbox** : 返回 4 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple4_Unbox)] - [[play](https://go.dev/play/p/ACj9YuACGgW)] -- **Zip4** : 创建一个 Tuple4 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip4)] - [[play](https://go.dev/play/p/PEmTYVK5hL4)] -- **Unzip4** : 根据传入的 Tuple4 切片,创建一组和 Tuple4 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip4)] - [[play](https://go.dev/play/p/rb8z4gyYSRN)] -- **Tuple5** : 5 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple5)] - [[play](https://go.dev/play/p/2WndmVxPg-r)] -- **Tuple5_Unbox** : 返回 5 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple5_Unbox)] - [[play](https://go.dev/play/p/GyIyZHjCvoS)] -- **Zip5** : 创建一个 Tuple5 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip5)] - [[play](https://go.dev/play/p/fCAAJLMfBIP)] -- **Unzip5** : 根据传入的 Tuple5 切片,创建一组和 Tuple5 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip5)] - [[play](https://go.dev/play/p/gyl6vKfhqPb)] -- **Tuple6** : 6 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple6)] - [[play](https://go.dev/play/p/VjqcCwEJZbs)] -- **Tuple6_Unbox** : 返回 6 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple6_Unbox)] - [[play](https://go.dev/play/p/FjIHV7lpxmW)] -- **Zip6** : 创建一个 Tuple6 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip6)] - [[play](https://go.dev/play/p/oWPrnUYuFHo)] -- **Unzip6** : 根据传入的 Tuple6 切片,创建一组和 Tuple6 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip6)] - [[play](https://go.dev/play/p/l41XFqCyh5E)] -- **Tuple7** : 7 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple7)] - [[play](https://go.dev/play/p/dzAgv_Ezub9)] -- **Tuple7_Unbox** : 返回 7 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple7_Unbox)] - [[play](https://go.dev/play/p/R9I8qeDk0zs)] -- **Zip7** : 创建一个 Tuple7 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip7)] - [[play](https://go.dev/play/p/WUJuo897Egf)] -- **Unzip7** : 根据传入的 Tuple7 切片,创建一组和 Tuple7 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip7)] - [[play](https://go.dev/play/p/hws_P1Fr2j3)] -- **Tuple8** : 8 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple8)] - [[play](https://go.dev/play/p/YA9S0rz3dRz)] -- **Tuple8_Unbox** : 返回 8 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple8_Unbox)] - [[play](https://go.dev/play/p/PRxLBBb4SMl)] -- **Zip8** : 创建一个 Tuple8 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip8)] - [[play](https://go.dev/play/p/8V9jWkuJfaQ)] -- **Unzip8** : 根据传入的 Tuple8 切片,创建一组和 Tuple8 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip8)] - [[play](https://go.dev/play/p/1SndOwGsZB4)] -- **Tuple9** : 9 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple9)] - [[play](https://go.dev/play/p/yS2NGGtZpQr)] -- **Tuple9_Unbox** : 返回 9 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple9_Unbox)] - [[play](https://go.dev/play/p/oFJFGTAuOa8)] -- **Zip9** : 创建一个 Tuple9 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip9)] - [[play](https://go.dev/play/p/cgsL15QYnfz)] -- **Unzip9** : 根据传入的 Tuple9 切片,创建一组和 Tuple9 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip9)] - [[play](https://go.dev/play/p/91-BU_KURSA)] -- **Tuple10** : 10 元元组 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple10)] - [[play](https://go.dev/play/p/799qqZg0hUv)] -- **Tuple10_Unbox** : 返回 10 元元组的字段值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple10_Unbox)] - [[play](https://go.dev/play/p/qfyx3x_X0Cu)] -- **Zip10** : 创建一个 Tuple10 元组切片, 其中元组的元素和传入切片元素相对应。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip10)] - [[play](https://go.dev/play/p/YSR-2cXnrY4)] -- **Unzip10** : 根据传入的 Tuple10 切片,创建一组和 Tuple10 元素相对应的切片。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip10)] - [[play](https://go.dev/play/p/-taQB6Wfre_z)] +- **Tuple2** : 2 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple2)] + [[play](https://go.dev/play/p/3sHVqBQpLYN)] +- **Tuple2_Unbox** : 返回 2 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple2_Unbox)] + [[play](https://go.dev/play/p/0fD1qfCVwjm)] +- **Zip2** : 创建一个 Tuple2 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip2)] + [[play](https://go.dev/play/p/4ncWJJ77Xio)] +- **Unzip2** : 根据传入的 Tuple2 切片,创建一组和 Tuple2 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip2)] + [[play](https://go.dev/play/p/KBecr60feXb)] +- **Tuple3** : 3 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple3)] + [[play](https://go.dev/play/p/FtH2sdCLlCf)] +- **Tuple3_Unbox** : 返回 3 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple3_Unbox)] + [[play](https://go.dev/play/p/YojLy-id1BS)] +- **Zip3** : 创建一个 Tuple3 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip3)] + [[play](https://go.dev/play/p/97NgmsTILfu)] +- **Unzip3** : 根据传入的 Tuple3 切片,创建一组和 Tuple3 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip3)] + [[play](https://go.dev/play/p/bba4cpAa7KO)] +- **Tuple4** : 4 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple4)] + [[play](https://go.dev/play/p/D2EqDz096tk)] +- **Tuple4_Unbox** : 返回 4 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple4_Unbox)] + [[play](https://go.dev/play/p/ACj9YuACGgW)] +- **Zip4** : 创建一个 Tuple4 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip4)] + [[play](https://go.dev/play/p/PEmTYVK5hL4)] +- **Unzip4** : 根据传入的 Tuple4 切片,创建一组和 Tuple4 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip4)] + [[play](https://go.dev/play/p/rb8z4gyYSRN)] +- **Tuple5** : 5 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple5)] + [[play](https://go.dev/play/p/2WndmVxPg-r)] +- **Tuple5_Unbox** : 返回 5 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple5_Unbox)] + [[play](https://go.dev/play/p/GyIyZHjCvoS)] +- **Zip5** : 创建一个 Tuple5 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip5)] + [[play](https://go.dev/play/p/fCAAJLMfBIP)] +- **Unzip5** : 根据传入的 Tuple5 切片,创建一组和 Tuple5 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip5)] + [[play](https://go.dev/play/p/gyl6vKfhqPb)] +- **Tuple6** : 6 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple6)] + [[play](https://go.dev/play/p/VjqcCwEJZbs)] +- **Tuple6_Unbox** : 返回 6 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple6_Unbox)] + [[play](https://go.dev/play/p/FjIHV7lpxmW)] +- **Zip6** : 创建一个 Tuple6 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip6)] + [[play](https://go.dev/play/p/oWPrnUYuFHo)] +- **Unzip6** : 根据传入的 Tuple6 切片,创建一组和 Tuple6 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip6)] + [[play](https://go.dev/play/p/l41XFqCyh5E)] +- **Tuple7** : 7 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple7)] + [[play](https://go.dev/play/p/dzAgv_Ezub9)] +- **Tuple7_Unbox** : 返回 7 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple7_Unbox)] + [[play](https://go.dev/play/p/R9I8qeDk0zs)] +- **Zip7** : 创建一个 Tuple7 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip7)] + [[play](https://go.dev/play/p/WUJuo897Egf)] +- **Unzip7** : 根据传入的 Tuple7 切片,创建一组和 Tuple7 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip7)] + [[play](https://go.dev/play/p/hws_P1Fr2j3)] +- **Tuple8** : 8 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple8)] + [[play](https://go.dev/play/p/YA9S0rz3dRz)] +- **Tuple8_Unbox** : 返回 8 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple8_Unbox)] + [[play](https://go.dev/play/p/PRxLBBb4SMl)] +- **Zip8** : 创建一个 Tuple8 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip8)] + [[play](https://go.dev/play/p/8V9jWkuJfaQ)] +- **Unzip8** : 根据传入的 Tuple8 切片,创建一组和 Tuple8 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip8)] + [[play](https://go.dev/play/p/1SndOwGsZB4)] +- **Tuple9** : 9 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple9)] + [[play](https://go.dev/play/p/yS2NGGtZpQr)] +- **Tuple9_Unbox** : 返回 9 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple9_Unbox)] + [[play](https://go.dev/play/p/oFJFGTAuOa8)] +- **Zip9** : 创建一个 Tuple9 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip9)] + [[play](https://go.dev/play/p/cgsL15QYnfz)] +- **Unzip9** : 根据传入的 Tuple9 切片,创建一组和 Tuple9 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip9)] + [[play](https://go.dev/play/p/91-BU_KURSA)] +- **Tuple10** : 10 元元组 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple10)] + [[play](https://go.dev/play/p/799qqZg0hUv)] +- **Tuple10_Unbox** : 返回 10 元元组的字段值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Tuple10_Unbox)] + [[play](https://go.dev/play/p/qfyx3x_X0Cu)] +- **Zip10** : 创建一个 Tuple10 元组切片, 其中元组的元素和传入切片元素相对应。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Zip10)] + [[play](https://go.dev/play/p/YSR-2cXnrY4)] +- **Unzip10** : 根据传入的 Tuple10 切片,创建一组和 Tuple10 元素相对应的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/tuple.md#Unzip10)] + [[play](https://go.dev/play/p/-taQB6Wfre_z)]

26. validator 验证器包,包含常用字符串格式验证函数。       回到目录

@@ -2308,144 +2308,144 @@ import "github.com/duke-git/lancet/v2/validator" #### 函数列表: -- **ContainChinese** : 验证字符串是否包含中文字符。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainChinese)] - [[play](https://go.dev/play/p/7DpU0uElYeM)] -- **ContainLetter** : 验证字符串是否包含至少一个英文字母。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainLetter)] - [[play](https://go.dev/play/p/lqFD04Yyewp)] -- **ContainLower** : 验证字符串是否包含至少一个英文小写字母。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainLower)] - [[play](https://go.dev/play/p/Srqi1ItvnAA)] -- **ContainUpper** : 验证字符串是否包含至少一个英文大写字母。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainUpper)] - [[play](https://go.dev/play/p/CmWeBEk27-z)] -- **IsAlpha** : 验证字符串是否只包含英文字母。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAlpha)] - [[play](https://go.dev/play/p/7Q5sGOz2izQ)] -- **IsAllUpper** : 验证字符串是否全是大写英文字母。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAllUpper)] - [[play](https://go.dev/play/p/ZHctgeK1n4Z)] -- **IsAllLower** : 验证字符串是否全是小写英文字母。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAllLower)] - [[play](https://go.dev/play/p/GjqCnOfV6cM)] -- **IsBase64** : 验证字符串是否是 base64 编码。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsBase64)] - [[play](https://go.dev/play/p/sWHEySAt6hl)] -- **IsChineseMobile** : 验证字符串是否是中国手机号码。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChineseMobile)] - [[play](https://go.dev/play/p/GPYUlGTOqe3)] -- **IsChineseIdNum** : 验证字符串是否是中国身份证号码。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChineseIdNum)] - [[play](https://go.dev/play/p/d8EWhl2UGDF)] -- **IsChinesePhone** : 验证字符串是否是中国电话座机号码(xxx-xxxxxxxx or xxxx-xxxxxxx.)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChinesePhone)] - [[play](https://go.dev/play/p/RUD_-7YZJ3I)] -- **IsCreditCard** : 验证字符串是否是信用卡号码。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsCreditCard)] - [[play](https://go.dev/play/p/sNwwL6B0-v4)] -- **IsDns** : 验证字符串是否是有效 dns。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsDns)] - [[play](https://go.dev/play/p/jlYApVLLGTZ)] -- **IsEmail** : 验证字符串是否是有效电子邮件地址。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsEmail)] - [[play](https://go.dev/play/p/HVQ5LAe-vFz)] -- **IsEmptyString** : 验证字符串是否是空字符串。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsEmptyString)] - [[play](https://go.dev/play/p/dpzgUjFnBCX)] -- **IsFloat** : 验证参数是否是浮点数((float32,float34)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsFloat)] - [[play](https://go.dev/play/p/vsyG-sxr99_Z)] -- **IsFloatStr** : 验证字符串是否是可以转换为浮点数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsFloatStr)] - [[play](https://go.dev/play/p/LOYwS_Oyl7U)] -- **IsNumber** : 验证参数是否是数字(integer,float)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsNumber)] - [[play](https://go.dev/play/p/mdJHOAvtsvF)] -- **IsNumberStr** : 验证字符串是否是可以转换为数字。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsNumberStr)] - [[play](https://go.dev/play/p/LzaKocSV79u)] -- **IsAlphaNumeric** : 验证字符串是字母或数字。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAlphaNumeric)] - [[play](https://go.dev/play/p/RHeESLrLg9c)] -- **IsJSON** : 验证字符串是否是有效 json。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsJSON)] - [[play](https://go.dev/play/p/8Kip1Itjiil)] -- **IsRegexMatch** : 验证字符串是否可以匹配正则表达式。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsRegexMatch)] - [[play](https://go.dev/play/p/z_XeZo_litG)] -- **IsInt** : 验证参数是否是整数(int, unit)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsInt)] - [[play](https://go.dev/play/p/eFoIHbgzl-z)] -- **IsIntStr** : 验证字符串是否是可以转换为整数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIntStr)] - [[play](https://go.dev/play/p/jQRtFv-a0Rk)] -- **IsIp** : 验证字符串是否是 ip 地址。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIp)] - [[play](https://go.dev/play/p/FgcplDvmxoD)] -- **IsIpV4** : 验证字符串是否是 ipv4 地址。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIpV4)] - [[play](https://go.dev/play/p/zBGT99EjaIu)] -- **IsIpV6** : 验证字符串是否是 ipv6 地址。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIpV6)] - [[play](https://go.dev/play/p/AHA0r0AzIdC)] -- **IsIpPort** : 检查字符串是否是 ip:port 格式。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIpPort)] - [[play](https://go.dev/play/p/xUmls_b9L29)] -- **IsStrongPassword** : 验证字符串是否是强密码:(字母+数字+特殊字符)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsStrongPassword)] - [[play](https://go.dev/play/p/QHdVcSQ3uDg)] -- **IsUrl** : 验证字符串是否是 url。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsUrl)] - [[play](https://go.dev/play/p/pbJGa7F98Ka)] -- **IsWeakPassword** : 验证字符串是否是弱密码(只包含字母+数字)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsWeakPassword)] - [[play](https://go.dev/play/p/wqakscZH5gH)] -- **IsZeroValue** : 判断传入的参数值是否为零值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsZeroValue)] - [[play](https://go.dev/play/p/UMrwaDCi_t4)] -- **IsGBK** : 检查数据编码是否为 gbk(汉字内部代码扩展规范)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsGBK)] - [[play](https://go.dev/play/p/E2nt3unlmzP)] -- **IsASCII** : 验证字符串全部为 ASCII 字符。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsASCII)] - [[play](https://go.dev/play/p/hfQNPLX0jNa)] -- **IsPrintable** : 检查字符串是否全部为可打印字符。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsPrintable)] - [[play](https://go.dev/play/p/Pe1FE2gdtTP)] -- **IsBin** : 检查字符串是否是有效的二进制数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsBin)] - [[play](https://go.dev/play/p/ogPeg2XJH4P)] -- **IsHex** : 检查字符串是否是有效的十六进制数。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsHex)] - [[play](https://go.dev/play/p/M2qpHbEwmm7)] -- **IsBase64URL** : 检查字符串是否是有效的 base64 url。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsBase64URL)] - [[play](https://go.dev/play/p/vhl4mr8GZ6S)] -- **IsJWT** : 检查字符串是否是有效的 JSON Web Token (JWT)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsJWT)] - [[play](https://go.dev/play/p/R6Op7heJbKI)] -- **IsVisa** : 检查字符串是否是有效的 visa 卡号。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsVisa)] - [[play](https://go.dev/play/p/SdS2keOyJsl)] -- **IsMasterCard** : 检查字符串是否是有效的 MasterCard 卡号。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsMasterCard)] - [[play](https://go.dev/play/p/CwWBFRrG27b)] -- **IsAmericanExpress** : 检查字符串是否是有效的 American Express 卡号。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAmericanExpress)] - [[play](https://go.dev/play/p/HIDFpcOdpkd)] -- **IsUnionPay** : 检查字符串是否是有效的美国银联卡号。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsUnionPay)] - [[play](https://go.dev/play/p/CUHPEwEITDf)] -- **IsChinaUnionPay** : 检查字符串是否是有效的中国银联卡号。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChinaUnionPay)] - [[play](https://go.dev/play/p/yafpdxLiymu)] -- **IsPassport** : 判断护照(正则判断)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsPassport)] - [[play](https://go.dev/play/p/dvOiV2BW7Aw)] -- **IsChineseHMPassport** : 判断港澳台通行证(正则判断)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChineseHMPassport)] - [[play](https://go.dev/play/p/xKG6spQTcY0)] +- **ContainChinese** : 验证字符串是否包含中文字符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainChinese)] + [[play](https://go.dev/play/p/7DpU0uElYeM)] +- **ContainLetter** : 验证字符串是否包含至少一个英文字母。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainLetter)] + [[play](https://go.dev/play/p/lqFD04Yyewp)] +- **ContainLower** : 验证字符串是否包含至少一个英文小写字母。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainLower)] + [[play](https://go.dev/play/p/Srqi1ItvnAA)] +- **ContainUpper** : 验证字符串是否包含至少一个英文大写字母。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#ContainUpper)] + [[play](https://go.dev/play/p/CmWeBEk27-z)] +- **IsAlpha** : 验证字符串是否只包含英文字母。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAlpha)] + [[play](https://go.dev/play/p/7Q5sGOz2izQ)] +- **IsAllUpper** : 验证字符串是否全是大写英文字母。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAllUpper)] + [[play](https://go.dev/play/p/ZHctgeK1n4Z)] +- **IsAllLower** : 验证字符串是否全是小写英文字母。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAllLower)] + [[play](https://go.dev/play/p/GjqCnOfV6cM)] +- **IsBase64** : 验证字符串是否是 base64 编码。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsBase64)] + [[play](https://go.dev/play/p/sWHEySAt6hl)] +- **IsChineseMobile** : 验证字符串是否是中国手机号码。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChineseMobile)] + [[play](https://go.dev/play/p/GPYUlGTOqe3)] +- **IsChineseIdNum** : 验证字符串是否是中国身份证号码。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChineseIdNum)] + [[play](https://go.dev/play/p/d8EWhl2UGDF)] +- **IsChinesePhone** : 验证字符串是否是中国电话座机号码(xxx-xxxxxxxx or xxxx-xxxxxxx.)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChinesePhone)] + [[play](https://go.dev/play/p/RUD_-7YZJ3I)] +- **IsCreditCard** : 验证字符串是否是信用卡号码。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsCreditCard)] + [[play](https://go.dev/play/p/sNwwL6B0-v4)] +- **IsDns** : 验证字符串是否是有效 dns。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsDns)] + [[play](https://go.dev/play/p/jlYApVLLGTZ)] +- **IsEmail** : 验证字符串是否是有效电子邮件地址。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsEmail)] + [[play](https://go.dev/play/p/HVQ5LAe-vFz)] +- **IsEmptyString** : 验证字符串是否是空字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsEmptyString)] + [[play](https://go.dev/play/p/dpzgUjFnBCX)] +- **IsFloat** : 验证参数是否是浮点数((float32,float34)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsFloat)] + [[play](https://go.dev/play/p/vsyG-sxr99_Z)] +- **IsFloatStr** : 验证字符串是否是可以转换为浮点数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsFloatStr)] + [[play](https://go.dev/play/p/LOYwS_Oyl7U)] +- **IsNumber** : 验证参数是否是数字(integer,float)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsNumber)] + [[play](https://go.dev/play/p/mdJHOAvtsvF)] +- **IsNumberStr** : 验证字符串是否是可以转换为数字。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsNumberStr)] + [[play](https://go.dev/play/p/LzaKocSV79u)] +- **IsAlphaNumeric** : 验证字符串是字母或数字。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAlphaNumeric)] + [[play](https://go.dev/play/p/RHeESLrLg9c)] +- **IsJSON** : 验证字符串是否是有效 json。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsJSON)] + [[play](https://go.dev/play/p/8Kip1Itjiil)] +- **IsRegexMatch** : 验证字符串是否可以匹配正则表达式。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsRegexMatch)] + [[play](https://go.dev/play/p/z_XeZo_litG)] +- **IsInt** : 验证参数是否是整数(int, unit)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsInt)] + [[play](https://go.dev/play/p/eFoIHbgzl-z)] +- **IsIntStr** : 验证字符串是否是可以转换为整数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIntStr)] + [[play](https://go.dev/play/p/jQRtFv-a0Rk)] +- **IsIp** : 验证字符串是否是 ip 地址。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIp)] + [[play](https://go.dev/play/p/FgcplDvmxoD)] +- **IsIpV4** : 验证字符串是否是 ipv4 地址。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIpV4)] + [[play](https://go.dev/play/p/zBGT99EjaIu)] +- **IsIpV6** : 验证字符串是否是 ipv6 地址。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIpV6)] + [[play](https://go.dev/play/p/AHA0r0AzIdC)] +- **IsIpPort** : 检查字符串是否是 ip:port 格式。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsIpPort)] + [[play](https://go.dev/play/p/xUmls_b9L29)] +- **IsStrongPassword** : 验证字符串是否是强密码:(字母+数字+特殊字符)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsStrongPassword)] + [[play](https://go.dev/play/p/QHdVcSQ3uDg)] +- **IsUrl** : 验证字符串是否是 url。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsUrl)] + [[play](https://go.dev/play/p/pbJGa7F98Ka)] +- **IsWeakPassword** : 验证字符串是否是弱密码(只包含字母+数字)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsWeakPassword)] + [[play](https://go.dev/play/p/wqakscZH5gH)] +- **IsZeroValue** : 判断传入的参数值是否为零值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsZeroValue)] + [[play](https://go.dev/play/p/UMrwaDCi_t4)] +- **IsGBK** : 检查数据编码是否为 gbk(汉字内部代码扩展规范)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsGBK)] + [[play](https://go.dev/play/p/E2nt3unlmzP)] +- **IsASCII** : 验证字符串全部为 ASCII 字符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsASCII)] + [[play](https://go.dev/play/p/hfQNPLX0jNa)] +- **IsPrintable** : 检查字符串是否全部为可打印字符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsPrintable)] + [[play](https://go.dev/play/p/Pe1FE2gdtTP)] +- **IsBin** : 检查字符串是否是有效的二进制数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsBin)] + [[play](https://go.dev/play/p/ogPeg2XJH4P)] +- **IsHex** : 检查字符串是否是有效的十六进制数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsHex)] + [[play](https://go.dev/play/p/M2qpHbEwmm7)] +- **IsBase64URL** : 检查字符串是否是有效的 base64 url。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsBase64URL)] + [[play](https://go.dev/play/p/vhl4mr8GZ6S)] +- **IsJWT** : 检查字符串是否是有效的 JSON Web Token (JWT)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsJWT)] + [[play](https://go.dev/play/p/R6Op7heJbKI)] +- **IsVisa** : 检查字符串是否是有效的 visa 卡号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsVisa)] + [[play](https://go.dev/play/p/SdS2keOyJsl)] +- **IsMasterCard** : 检查字符串是否是有效的 MasterCard 卡号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsMasterCard)] + [[play](https://go.dev/play/p/CwWBFRrG27b)] +- **IsAmericanExpress** : 检查字符串是否是有效的 American Express 卡号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsAmericanExpress)] + [[play](https://go.dev/play/p/HIDFpcOdpkd)] +- **IsUnionPay** : 检查字符串是否是有效的美国银联卡号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsUnionPay)] + [[play](https://go.dev/play/p/CUHPEwEITDf)] +- **IsChinaUnionPay** : 检查字符串是否是有效的中国银联卡号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChinaUnionPay)] + [[play](https://go.dev/play/p/yafpdxLiymu)] +- **IsPassport** : 判断护照(正则判断)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsPassport)] + [[play](https://go.dev/play/p/dvOiV2BW7Aw)] +- **IsChineseHMPassport** : 判断港澳台通行证(正则判断)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/validator.md#IsChineseHMPassport)] + [[play](https://go.dev/play/p/xKG6spQTcY0)]

27. xerror 包实现一些错误处理函数。       回到目录

@@ -2455,48 +2455,48 @@ import "github.com/duke-git/lancet/v2/xerror" #### 函数列表: -- **New** : 创建 XError 对象实例。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#New)] - [[play](https://go.dev/play/p/w4oWZts7q7f)] -- **Wrap** : 根据 error 对象创建 XError 对象实例,可添加 message。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#Wrap)] - [[play](https://go.dev/play/p/5385qT2dCi4)] -- **Unwrap** : 从 error 对象中解构出 XError。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#Unwrap)] - [[play](https://go.dev/play/p/LKMLep723tu)] -- **XError_Wrap** : 创建新的 XError 对象并将消息和 id 复制到新的对象中。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Wrap)] - [[play](https://go.dev/play/p/RpjJ5u5sc97)] -- **XError_Unwrap** : 解构 XEerror 为 error 对象。适配 github.com/pkg/errors。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Unwrap) - [[play](https://go.dev/play/p/VUXJ8BST4c6)] -- **XError_With** : 添加与 XError 对象的键和值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_With)] - [[play](https://go.dev/play/p/ow8UISXX_Dp)] -- **XError_Id** : 设置 XError 对象的 id。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Id)] - [[play](https://go.dev/play/p/X6HBlsy58U9)] -- **XError_Is** : 检查目标 error 是否为 XError,两个错误中的 error.id 是否匹配。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Is)] - [[play](https://go.dev/play/p/X6HBlsy58U9)] -- **XError_Values** : 返回由 With 设置的键和值的映射。将合并所有 XError 键和值。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Values)] - [[play](https://go.dev/play/p/ow8UISXX_Dp)] -- **XError_StackTrace** : 返回与 pkg/error 兼容的堆栈信息。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_StackTrace)] - [[play](https://go.dev/play/p/6FAvSQpa7pc)] -- **XError_Info** : 返回可打印的 XError 对象信息。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Info)] - [[play](https://go.dev/play/p/1ZX0ME1F-Jb)] -- **XError_Error** : 实现标准库的 error 接口。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Error)] - [[play](https://go.dev/play/p/w4oWZts7q7f)] -- **TryUnwrap** : 检查 error, 如果 err 为 nil 则展开,则它返回一个有效值,如果 err 不是 nil 则 Unwrap 使用 err 发生 panic。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#TryUnwrap)] - [[play](https://go.dev/play/p/acyZVkNZEeW)] -- **TryCatch** : 简单实现的 java 风格异常处理(try-catch-finally)。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#TryCatch)] - [[play](https://go.dev/play/p/D5Mdb0mRj0P)] +- **New** : 创建 XError 对象实例。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#New)] + [[play](https://go.dev/play/p/w4oWZts7q7f)] +- **Wrap** : 根据 error 对象创建 XError 对象实例,可添加 message。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#Wrap)] + [[play](https://go.dev/play/p/5385qT2dCi4)] +- **Unwrap** : 从 error 对象中解构出 XError。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#Unwrap)] + [[play](https://go.dev/play/p/LKMLep723tu)] +- **XError_Wrap** : 创建新的 XError 对象并将消息和 id 复制到新的对象中。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Wrap)] + [[play](https://go.dev/play/p/RpjJ5u5sc97)] +- **XError_Unwrap** : 解构 XEerror 为 error 对象。适配 github.com/pkg/errors。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Unwrap) + [[play](https://go.dev/play/p/VUXJ8BST4c6)] +- **XError_With** : 添加与 XError 对象的键和值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_With)] + [[play](https://go.dev/play/p/ow8UISXX_Dp)] +- **XError_Id** : 设置 XError 对象的 id。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Id)] + [[play](https://go.dev/play/p/X6HBlsy58U9)] +- **XError_Is** : 检查目标 error 是否为 XError,两个错误中的 error.id 是否匹配。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Is)] + [[play](https://go.dev/play/p/X6HBlsy58U9)] +- **XError_Values** : 返回由 With 设置的键和值的映射。将合并所有 XError 键和值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Values)] + [[play](https://go.dev/play/p/ow8UISXX_Dp)] +- **XError_StackTrace** : 返回与 pkg/error 兼容的堆栈信息。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_StackTrace)] + [[play](https://go.dev/play/p/6FAvSQpa7pc)] +- **XError_Info** : 返回可打印的 XError 对象信息。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Info)] + [[play](https://go.dev/play/p/1ZX0ME1F-Jb)] +- **XError_Error** : 实现标准库的 error 接口。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#XError_Error)] + [[play](https://go.dev/play/p/w4oWZts7q7f)] +- **TryUnwrap** : 检查 error, 如果 err 为 nil 则展开,则它返回一个有效值,如果 err 不是 nil 则 Unwrap 使用 err 发生 panic。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#TryUnwrap)] + [[play](https://go.dev/play/p/acyZVkNZEeW)] +- **TryCatch** : 简单实现的 java 风格异常处理(try-catch-finally)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/xerror.md#TryCatch)] + [[play](https://go.dev/play/p/D5Mdb0mRj0P)] ## 如何贡献代码