From 84ebc7ce71f6008d8aa39206df3f32d3e62bd104 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Tue, 10 Sep 2024 14:47:38 +0800 Subject: [PATCH] doc: add doc for new functions of release v2.3.3 --- README.md | 147 +++++++++++++++++++++++++++--- README_zh-CN.md | 148 ++++++++++++++++++++++++++++--- docs/api/packages/datetime.md | 6 +- docs/api/packages/function.md | 4 +- docs/api/packages/maputil.md | 2 +- docs/api/packages/random.md | 14 +-- docs/api/packages/slice.md | 6 +- docs/api/packages/strutil.md | 12 +-- docs/en/api/packages/datetime.md | 6 +- docs/en/api/packages/function.md | 4 +- docs/en/api/packages/maputil.md | 38 ++++---- docs/en/api/packages/random.md | 12 +-- docs/en/api/packages/slice.md | 8 +- docs/en/api/packages/strutil.md | 12 +-- 14 files changed, 338 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index ce9339c..59fc70a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ ## Features - 👏 Comprehensive, efficient and reusable. -- 💪 600+ go util functions, support string, slice, datetime, net, crypt... +- 💪 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. @@ -362,6 +362,12 @@ import "github.com/duke-git/lancet/v2/cryptor" - **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](todo)] +- **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](todo)] - **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)] @@ -603,6 +609,16 @@ import "github.com/duke-git/lancet/v2/datetime" - **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](todo)] +- **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](todo)] +- **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](todo)] +

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

@@ -792,9 +808,15 @@ import "github.com/duke-git/lancet/v2/function" - **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)] -- **Debounced** : creates a debounced function that delays invoking fn until after wait duration have elapsed since the last time the debounced function was invoked. +- **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](todo)] +- **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](todo)] - **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)] @@ -913,6 +935,60 @@ import "github.com/duke-git/lancet/v2/maputil" - **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **OrderedMap_Clear** : clears the ordered map. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Clear)] + [[play](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] - **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)] @@ -937,6 +1013,10 @@ import "github.com/duke-git/lancet/v2/maputil" - **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](todo)] +

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

@@ -1170,17 +1250,33 @@ import "github.com/duke-git/lancet/v2/random" - **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. +- **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. +- **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. +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)]

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

@@ -1323,6 +1419,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)] - **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)] @@ -1350,6 +1449,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)] - **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)] @@ -1365,6 +1467,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)] - **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)] @@ -1421,11 +1526,13 @@ import "github.com/duke-git/lancet/v2/slice" [[play](https://go.dev/play/p/UR323iZLDpv)] - **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](todo)] - **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)] -- **UniqueByParallel** : remove duplicate elements from the slice by parallel. - [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByParallel)] +- **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](todo)] - **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)] @@ -1461,6 +1568,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)]

19. Stream package implements a sequence of elements supporting sequential and operations. this package is an experiment to explore if stream in go can work as the way java does. its function is very limited.        index

@@ -1495,6 +1605,9 @@ import "github.com/duke-git/lancet/v2/stream" - **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](todo)] - **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)] @@ -1712,7 +1825,21 @@ import "github.com/duke-git/lancet/v2/strutil" - **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)] +- **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](todo)]

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

diff --git a/README_zh-CN.md b/README_zh-CN.md index d8c27d3..b883cc0 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -23,7 +23,7 @@ ## 特性 - 👏 全面、高效、可复用。 -- 💪 600+常用 go 工具函数,支持 string、slice、datetime、net、crypt... +- 💪 700+常用 go 工具函数,支持 string、slice、datetime、net、crypt... - 💅 只依赖 go 标准库和 golang.org/x。 - 🌍 所有导出函数单元测试覆盖率 100%。 @@ -363,6 +363,12 @@ import "github.com/duke-git/lancet/v2/cryptor" - **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](todo)] +- **AesGcmDecrypt** : 使用 AES GCM 算法模式解密数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#AesGcmDecrypt)] + [[play](todo)] - **Base64StdEncode** : 将字符串 base64 编码。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/cryptor.md#Base64StdEncode)] [[play](https://go.dev/play/p/VOaUyQUreoK)] @@ -472,7 +478,7 @@ import "github.com/duke-git/lancet/v2/cryptor" [[play](https://go.dev/play/p/sSVmkfENKMz)] -

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

+

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

```go import "github.com/duke-git/lancet/v2/datetime" @@ -606,6 +612,16 @@ import "github.com/duke-git/lancet/v2/datetime" - **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](todo)] +- **DaysBetween** : 返回两个日期之间的天数差。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#DaysBetween)] + [[play](todo)] +- **GenerateDatetimesBetween** : 生成从start到end的所有日期时间的字符串列表。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/datetime.md#GenerateDatetimesBetween)] + [[play](todo)] +

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

@@ -793,9 +809,15 @@ import "github.com/duke-git/lancet/v2/function" - **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)] -- **Debounced** : 创建一个 debounced 函数,该函数延迟调用 fn 直到自上次调用 debounced 函数后等待持续时间过去。 +- **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](todo)] +- **Throttle** : 创建一个函数的节流版本。返回的函数保证在每个时间间隔内最多只会被调用一次。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/function.md#Throttle)] + [[play](todo)] - **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)] @@ -915,6 +937,60 @@ import "github.com/duke-git/lancet/v2/maputil" - **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](todo)] +- **OrderedMap_Set** : 设置给定的键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Set)] + [[play](todo)] +- **OrderedMap_Get** : 返回给定键的值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Get)] + [[play](todo)] +- **OrderedMap_Delete** : 删除给定键的键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Delete)] + [[play](todo)] +- **OrderedMap_Clear** : 清空map数据。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Clear)] + [[play](todo)] +- **OrderedMap_Front** : 返回第一个键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Front)] + [[play](todo)] +- **OrderedMap_Back** : 返回最后一个键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Back)] + [[play](todo)] +- **OrderedMap_Range** : 为每个键值对调用给定的函数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Range)] + [[play](todo)] +- **OrderedMap_Keys** : 按顺序返回键的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Keys)] + [[play](todo)] +- **OrderedMap_Values** : 按顺序返回值的切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Values)] + [[play](todo)] +- **OrderedMap_Elements** : 按顺序返回键值对。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Elements)] + [[play](todo)] +- **OrderedMap_Len** : 返回键值对的数量。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Len)] + [[play](todo)] +- **OrderedMap_Contains** : 如果给定的键存在则返回true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Contains)] + [[play](todo)] +- **OrderedMap_Iter** : 返回按顺序产生键值对的通道。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_Iter)] + [[play](todo)] +- **OrderedMap_ReverseIter** : 返回以相反顺序产生键值对的通道。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_ReverseIter)] + [[play](todo)] +- **OrderedMap_SortByKey** : 使用传入的比较函数排序map key。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_SortByKey)] + [[play](todo)] +- **OrderedMap_MarshalJSON** : 实现json.Marshaler接口。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_MarshalJSON)] + [[play](todo)] +- **OrderedMap_UnmarshalJSON** : 实现json.Unmarshaler接口。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/maputil.md#OrderedMap_UnmarshalJSON)] + [[play](todo)] - **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)] @@ -939,6 +1015,10 @@ import "github.com/duke-git/lancet/v2/maputil" - **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](todo)] +

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

@@ -1181,6 +1261,24 @@ import "github.com/duke-git/lancet/v2/random" - **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](todo)] +- **RandBool** : 生成随机bool值(true or false)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBool)] + [[play](todo)] +- **RandBoolSlice** : 生成特定长度的随机bool slice。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandBoolSlice)] + [[play](todo)] +- **RandIntSlice** : 生成一个特定长度的随机int切片,数值范围[min, max)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandIntSlice)] + [[play](todo)] +- **RandFromGivenSlice** : 从给定切片中随机生成元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFromGivenSlice)] + [[play](todo)] +- **RandSliceFromGivenSlice** : 从给定切片中生成长度为 num 的随机切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandSliceFromGivenSlice)] + [[play](todo)]

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

@@ -1318,6 +1416,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)] - **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)] @@ -1348,6 +1449,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)] - **Merge** : 合并多个切片(不会消除重复元素)。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Merge)] [[play](https://go.dev/play/p/lbjFp784r9N)] @@ -1363,6 +1467,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)] - **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)] @@ -1419,11 +1526,13 @@ import "github.com/duke-git/lancet/v2/slice" [[play](https://go.dev/play/p/UR323iZLDpv)] - **UniqueByComparator** : 使用提供的比较器函数从输入切片中移除重复元素。此函数保持元素的顺序。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByComparator)] + [[play](todo)] - **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)] -- **UniqueByParallel** : 并发的从输入切片中移除重复元素,结果保持元素的顺序。 - [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByParallel)] +- **UniqueByConcurrent** : 并发的从输入切片中移除重复元素,结果保持元素的顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#UniqueByConcurrent)] + [[play](todo)] - **Union** : 合并多个切片。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Union)] [[play](https://go.dev/play/p/hfXV1iRIZOf)] @@ -1458,7 +1567,9 @@ import "github.com/duke-git/lancet/v2/slice" - **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](todo)]

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

@@ -1487,12 +1598,15 @@ import "github.com/duke-git/lancet/v2/stream" - **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,用于删除重复的项。 +- **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。 +- **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](todo)] - **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)] @@ -1714,7 +1828,21 @@ import "github.com/duke-git/lancet/v2/strutil" - **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](todo)] +- **Ellipsis** : 将字符串截断到指定长度,并在末尾添加省略号。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Ellipsis)] + [[play](todo)] +- **Shuffle** : 打乱给定字符串中的字符顺序。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Shuffle)] + [[play](todo)] +- **Rotate** : 按指定的字符数旋转字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Rotate)] + [[play](todo)] +- **TemplateReplace** : 将模板字符串中的占位符替换为map中的相应值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#TemplateReplace)] + [[play](todo)]

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

@@ -1986,7 +2114,7 @@ import "github.com/duke-git/lancet/v2/validator" [[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/en/api/packages/validator.md#IsJWT)] + [[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)] diff --git a/docs/api/packages/datetime.md b/docs/api/packages/datetime.md index e808f7b..a9ead3c 100644 --- a/docs/api/packages/datetime.md +++ b/docs/api/packages/datetime.md @@ -1479,7 +1479,7 @@ func main() { func TrackFuncTime(pre time.Time) func() ``` -示例:[运行]() +示例:[运行](todo) ```go package main @@ -1511,7 +1511,7 @@ func main() { func DaysBetween(start, end time.Time) int ``` -示例:[运行]() +示例:[运行](todo) ```go package main @@ -1544,7 +1544,7 @@ func main() { func GenerateDatetimesBetween(start, end time.Time, layout string, interval string) ([]string, error) ``` -示例:[运行]() +示例:[运行](todo) ```go package main diff --git a/docs/api/packages/function.md b/docs/api/packages/function.md index 554b27e..1db408b 100644 --- a/docs/api/packages/function.md +++ b/docs/api/packages/function.md @@ -205,7 +205,7 @@ func main() { func Debounce(fn func(), delay time.Duration) (debouncedFn func(), cancelFn func()) ``` -示例: +示例:[运行](todo) ```go package main @@ -753,7 +753,7 @@ func main() { func Throttle(fn func(), interval time.Duration) func() ``` -示例: +示例:[运行](todo) ```go package main diff --git a/docs/api/packages/maputil.md b/docs/api/packages/maputil.md index d0510c0..44345b9 100644 --- a/docs/api/packages/maputil.md +++ b/docs/api/packages/maputil.md @@ -2238,7 +2238,7 @@ func main() { func SortByKey[K constraints.Ordered, V any](m map[K]V) (sortedKeysMap map[K]V) ``` -示例:[运行]() +示例:[运行](todo) ```go package main diff --git a/docs/api/packages/random.md b/docs/api/packages/random.md index 3f58bff..9b94360 100644 --- a/docs/api/packages/random.md +++ b/docs/api/packages/random.md @@ -126,7 +126,7 @@ func main() { ### RandFromGivenSlice -

从给定切片中随机生成元素

+

从给定切片中随机生成元素。

函数签名: @@ -134,7 +134,7 @@ func main() { func RandFromGivenSlice[T any](slice []T) T ``` -示例:[运行]() +示例:[运行](todo) ```go package main @@ -153,7 +153,7 @@ func main() { ### RandSliceFromGivenSlice -

从给定切片中生成长度为 num 的随机切片

+

从给定切片中生成长度为 num 的随机切片。

函数签名: @@ -161,7 +161,7 @@ func main() { func RandSliceFromGivenSlice[T any](slice []T, num int, repeatable bool) []T ``` -示例:[运行]() +示例:[运行](todo) ```go package main @@ -451,7 +451,7 @@ func main() { func RandStringSlice(charset string, sliceLen, strLen int) []string ``` -实例: +实例:[运行](todo) ```go package main @@ -480,7 +480,7 @@ func main() { func RandBool() bool ``` -实例: +实例:[运行](todo) ```go package main @@ -506,7 +506,7 @@ func main() { func RandBoolSlice(length int) []bool ``` -实例: +实例:[运行](todo) ```go package main diff --git a/docs/api/packages/slice.md b/docs/api/packages/slice.md index 7b87d05..a6341b6 100644 --- a/docs/api/packages/slice.md +++ b/docs/api/packages/slice.md @@ -915,7 +915,7 @@ func main() { func FilterConcurrent[T any](slice []T, predicate func(index int, item T) bool, numThreads int) []T ``` -示例: +示例:[运行](todo) ```go import ( @@ -1570,7 +1570,7 @@ func main() { func MapConcurrent[T any, U any](slice []T, iteratee func(index int, item T) U, numThreads int) []U ``` -示例: +示例:[运行](todo) ```go import ( @@ -1771,7 +1771,7 @@ func main() { func ReduceConcurrent[T any](slice []T, initial T, reducer func(index int, item T, agg T) T, numThreads int) T ``` -示例:[运行]() +示例:[运行](todo) ```go import ( diff --git a/docs/api/packages/strutil.md b/docs/api/packages/strutil.md index a108716..54d6bd3 100644 --- a/docs/api/packages/strutil.md +++ b/docs/api/packages/strutil.md @@ -1547,7 +1547,7 @@ func main() { func Concat(length int, str ...string) string ``` -示例:[运行]() +示例:[运行](todo) ```go import ( @@ -1581,7 +1581,7 @@ func main() { func Ellipsis(str string, length int) string ``` -示例:[运行]() +示例:[运行](todo) ```go import ( @@ -1615,7 +1615,7 @@ func main() { func Shuffle(str string) string ``` -示例:[运行]() +示例:[运行](todo) ```go import ( @@ -1639,7 +1639,7 @@ func main() { func Rotate(str string, shift int) string ``` -示例:[运行]() +示例:[运行](todo) ```go import ( @@ -1665,7 +1665,7 @@ func main() { ### TemplateReplace -

将模板字符串中的占位符替换为数据映射中的相应值。占位符括在花括号中,例如 {key}。例如,模板字符串为“Hello, {name}!”,数据映射为{"name": "world"},结果将为“Hello, world!”。

+

将模板字符串中的占位符替换为map中的相应值。占位符括在花括号中,例如 {key}。例如,模板字符串为“Hello, {name}!”,map为{"name": "world"},结果将为“Hello, world!”。

函数签名: @@ -1707,7 +1707,7 @@ func main() { func RegexMatchAllGroups(pattern, str string) [][]string ``` -示例:[Run]() +示例:[Run](todo) ```go import ( diff --git a/docs/en/api/packages/datetime.md b/docs/en/api/packages/datetime.md index 0d93777..184355d 100644 --- a/docs/en/api/packages/datetime.md +++ b/docs/en/api/packages/datetime.md @@ -1480,7 +1480,7 @@ func main() { func TrackFuncTime(pre time.Time) func() ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1512,7 +1512,7 @@ func main() { func DaysBetween(start, end time.Time) int ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1545,7 +1545,7 @@ func main() { func GenerateDatetimesBetween(start, end time.Time, layout string, interval string) ([]string, error) ``` -Example:[Run]() +Example:[Run](todo) ```go package main diff --git a/docs/en/api/packages/function.md b/docs/en/api/packages/function.md index dabdb30..1eca185 100644 --- a/docs/en/api/packages/function.md +++ b/docs/en/api/packages/function.md @@ -204,7 +204,7 @@ func main() { func Debounce(fn func(), delay time.Duration) (debouncedFn func(), cancelFn func()) ``` -Example: +Example:[Run](todo) ```go package main @@ -752,7 +752,7 @@ func main() { func Throttle(fn func(), interval time.Duration) func() ``` -Example: +Example:[Run](todo) ```go package main diff --git a/docs/en/api/packages/maputil.md b/docs/en/api/packages/maputil.md index 71f97e0..03a633f 100644 --- a/docs/en/api/packages/maputil.md +++ b/docs/en/api/packages/maputil.md @@ -77,6 +77,8 @@ import ( - [ConcurrentMap_Has](#ConcurrentMap_Has) - [ConcurrentMap_Range](#ConcurrentMap_Range) - [GetOrSet](#GetOrSet) +- [SortByKey](#SortByKey) +
@@ -1165,7 +1167,7 @@ func main() { func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V] ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1204,7 +1206,7 @@ func main() { func (om *OrderedMap[K, V]) Set(key K, value V) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1243,7 +1245,7 @@ func main() { func (om *OrderedMap[K, V]) Get(key K) (V, bool) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1283,7 +1285,7 @@ func main() { func (om *OrderedMap[K, V]) Delete(key K) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1319,7 +1321,7 @@ func main() { func (om *OrderedMap[K, V]) Clear() ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1358,7 +1360,7 @@ func (om *OrderedMap[K, V]) Front() (struct { }, bool) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1398,7 +1400,7 @@ func (om *OrderedMap[K, V]) Back() (struct { }, bool) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1435,7 +1437,7 @@ func main() { func (om *OrderedMap[K, V]) Range(iteratee func(key K, value V) bool) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1474,7 +1476,7 @@ func main() { func (om *OrderedMap[K, V]) Keys() []K ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1510,7 +1512,7 @@ func main() { func (om *OrderedMap[K, V]) Values() []V ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1546,7 +1548,7 @@ func main() { func (om *OrderedMap[K, V]) Elements() []struct ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1582,7 +1584,7 @@ func main() { func (om *OrderedMap[K, V]) Len() int ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1618,7 +1620,7 @@ func main() { func (om *OrderedMap[K, V]) Contains(key K) bool ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1660,7 +1662,7 @@ func (om *OrderedMap[K, V]) Iter() <-chan struct { } ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1739,7 +1741,7 @@ func main() { func (om *OrderedMap[K, V]) SortByKey(less func(a, b K) bool) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1778,7 +1780,7 @@ func main() { func (om *OrderedMap[K, V]) MarshalJSON() ([]byte, error) ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -1815,7 +1817,7 @@ func main() { func (om *OrderedMap[K, V]) UnmarshalJSON(data []byte) error ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -2254,7 +2256,7 @@ func main() { func SortByKey[K constraints.Ordered, V any](m map[K]V) (sortedKeysMap map[K]V) ``` -Example:[运行]() +Example:[Run](todo) ```go package main diff --git a/docs/en/api/packages/random.md b/docs/en/api/packages/random.md index ba2b7ce..d735f37 100644 --- a/docs/en/api/packages/random.md +++ b/docs/en/api/packages/random.md @@ -133,7 +133,7 @@ func main() { func RandFromGivenSlice[T any](slice []T) T ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -160,7 +160,7 @@ func main() { func RandSliceFromGivenSlice[T any](slice []T, num int, repeatable bool) []T ``` -Example:[Run]() +Example:[Run](todo) ```go package main @@ -346,7 +346,7 @@ func main() { func RandIntSlice(length, min, max int) []int ``` -Example: +Example:[Run](todo) ```go package main @@ -452,7 +452,7 @@ func main() { func RandStringSlice(charset string, sliceLen, strLen int) []string ``` -Example: +Example:[Run](todo) ```go package main @@ -481,7 +481,7 @@ func main() { func RandBool() bool ``` -Example: +Example:[Run](todo) ```go package main @@ -507,7 +507,7 @@ func main() { func RandBoolSlice(length int) []bool ``` -Example: +Example:[Run](todo) ```go package main diff --git a/docs/en/api/packages/slice.md b/docs/en/api/packages/slice.md index 1e6e7a6..a4d5cad 100644 --- a/docs/en/api/packages/slice.md +++ b/docs/en/api/packages/slice.md @@ -913,7 +913,7 @@ func main() { func FilterConcurrent[T any](slice []T, predicate func(index int, item T) bool, numThreads int) []T ``` -Example: +Example:[Run](todo) ```go import ( @@ -1190,7 +1190,7 @@ func main() { func ForEachConcurrent[T any](slice []T, iteratee func(index int, item T), numThreads int) ``` -Example:[Run]() +Example:[Run](todo) ```go import ( @@ -1766,7 +1766,7 @@ func main() { func ReduceConcurrent[T any](slice []T, initial T, reducer func(index int, item T, agg T) T, numThreads int) T ``` -Example:[运行]() +Example:[运行](todo) ```go import ( @@ -2962,7 +2962,7 @@ func main() { func Frequency[T comparable](slice []T) map[T]int ``` -Example:[Run]() +Example:[Run](todo) ```go import ( diff --git a/docs/en/api/packages/strutil.md b/docs/en/api/packages/strutil.md index d6575d7..a31afd5 100644 --- a/docs/en/api/packages/strutil.md +++ b/docs/en/api/packages/strutil.md @@ -1549,7 +1549,7 @@ func main() { func Concat(length int, str ...string) string ``` -Example:[Run]() +Example:[Run](todo) ```go import ( @@ -1582,7 +1582,7 @@ func main() { func Ellipsis(str string, length int) string ``` -Example:[Run]() +Example:[Run](todo) ```go import ( @@ -1616,7 +1616,7 @@ func main() { func Shuffle(str string) string ``` -Example:[Run]() +Example:[Run](todo) ```go import ( @@ -1640,7 +1640,7 @@ func main() { func Rotate(str string, shift int) string ``` -Example:[Run]() +Example:[Run](todo) ```go import ( @@ -1673,7 +1673,7 @@ func main() { func TemplateReplace(template string, data map[string]string string ``` -example:[Run]() +example:[Run](todo) ```go import ( @@ -1707,7 +1707,7 @@ func main() { func RegexMatchAllGroups(pattern, str string) [][]string ``` -example:[Run]() +example:[Run](todo) ```go import (