mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-23 13:52:26 +08:00
doc: add new function doc for v2.2.4
This commit is contained in:
50
README.md
50
README.md
@@ -388,32 +388,50 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
|||||||
- **<big>HmacMd5</big>** : return the md5 hmac hash of string.
|
- **<big>HmacMd5</big>** : return the md5 hmac hash of string.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacMd5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacMd5)]
|
||||||
[[play](https://go.dev/play/p/uef0q1fz53I)]
|
[[play](https://go.dev/play/p/uef0q1fz53I)]
|
||||||
|
- **<big>HmacMd5WithBase64</big>** : return the md5 hmac hash of base64 string.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacMd5WithBase64)]
|
||||||
- **<big>HmacSha1</big>** : return the hmac hash of string use sha1.
|
- **<big>HmacSha1</big>** : return the hmac hash of string use sha1.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha1)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha1)]
|
||||||
[[play](https://go.dev/play/p/1UI4oQ4WXKM)]
|
[[play](https://go.dev/play/p/1UI4oQ4WXKM)]
|
||||||
|
- **<big>HmacSha1WithBase64</big>** : return the hmac hash of string use sha1 with base64.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha1WithBase64)]
|
||||||
- **<big>HmacSha256</big>** : return the hmac hash of string use sha256.
|
- **<big>HmacSha256</big>** : return the hmac hash of string use sha256.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha256)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha256)]
|
||||||
[[play](https://go.dev/play/p/HhpwXxFhhC0)]
|
[[play](https://go.dev/play/p/HhpwXxFhhC0)]
|
||||||
|
- **<big>HmacSha256WithBase64</big>** : return the hmac hash of string use sha256 with base64.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha256WithBase64)]
|
||||||
- **<big>HmacSha512</big>** : return the hmac hash of string use sha512.
|
- **<big>HmacSha512</big>** : return the hmac hash of string use sha512.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha512)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha512)]
|
||||||
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
||||||
|
- **<big>HmacSha512WithBase64</big>** : return the hmac hash of string use sha512 with base64.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha512WithBase64)]
|
||||||
- **<big>Md5Byte</big>** : return the md5 string of byte slice.
|
- **<big>Md5Byte</big>** : return the md5 string of byte slice.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5Byte)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5Byte)]
|
||||||
[[play](https://go.dev/play/p/suraalH8lyC)]
|
[[play](https://go.dev/play/p/suraalH8lyC)]
|
||||||
|
- **<big>Md5ByteWithBase64</big>** : return the md5 string of byte slice with base64.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5ByteWithBase64)]
|
||||||
- **<big>Md5String</big>** : return the md5 value of string.
|
- **<big>Md5String</big>** : return the md5 value of string.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5String)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5String)]
|
||||||
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
||||||
|
- **<big>Md5StringWithBase64</big>** : return the md5 value of string with base64.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5StringWithBase64)]
|
||||||
- **<big>Md5File</big>** : return the md5 value of file.
|
- **<big>Md5File</big>** : return the md5 value of file.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5File)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5File)]
|
||||||
- **<big>Sha1</big>** : return the sha1 value (SHA-1 hash algorithm) of string.
|
- **<big>Sha1</big>** : return the sha1 value (SHA-1 hash algorithm) of base64 string.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha1)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha1)]
|
||||||
[[play](https://go.dev/play/p/_m_uoD1deMT)]
|
[[play](https://go.dev/play/p/_m_uoD1deMT)]
|
||||||
|
- **<big>Sha1WithBase64</big>** : return the sha1 value (SHA-1 hash algorithm) of string.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha1WithBase64)]
|
||||||
- **<big>Sha256</big>** : return the sha256 value (SHA-256 hash algorithm) of string.
|
- **<big>Sha256</big>** : return the sha256 value (SHA-256 hash algorithm) of string.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha256)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha256)]
|
||||||
[[play](https://go.dev/play/p/tU9tfBMIAr1)]
|
[[play](https://go.dev/play/p/tU9tfBMIAr1)]
|
||||||
|
- **<big>Sha256WithBase64</big>** : return the sha256 value (SHA256 hash algorithm) of base64 string.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha256WithBase64)]
|
||||||
- **<big>Sha512</big>** : return the sha512 value (SHA-512 hash algorithm) of string.
|
- **<big>Sha512</big>** : return the sha512 value (SHA-512 hash algorithm) of string.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha512)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha512)]
|
||||||
[[play](https://go.dev/play/p/3WsvLYZxsHa)]
|
[[play](https://go.dev/play/p/3WsvLYZxsHa)]
|
||||||
|
- **<big>Sha512WithBase64</big>** : return the sha512 value (SHA-512 hash algorithm) of base64 string.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Sha512WithBase64)]
|
||||||
- **<big>GenerateRsaKey</big>** : create rsa private and public pemo file.
|
- **<big>GenerateRsaKey</big>** : create rsa private and public pemo file.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#GenerateRsaKey)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#GenerateRsaKey)]
|
||||||
[[play](https://go.dev/play/p/zutRHrDqs0X)]
|
[[play](https://go.dev/play/p/zutRHrDqs0X)]
|
||||||
@@ -543,6 +561,16 @@ import "github.com/duke-git/lancet/v2/datetime"
|
|||||||
- **<big>IsWeekend</big>** : checks if passed time is weekend or not.
|
- **<big>IsWeekend</big>** : checks if passed time is weekend or not.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#IsWeekend)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#IsWeekend)]
|
||||||
[[play](https://go.dev/play/p/cupRM5aZOIY)]
|
[[play](https://go.dev/play/p/cupRM5aZOIY)]
|
||||||
|
- **<big>NowDateOrTime</big>** : returns current datetime with specific format and timezone.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#NowDateOrTime)]
|
||||||
|
- **<big>Timestamp</big>** : returns current second timestamp.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#Timestamp)]
|
||||||
|
- **<big>TimestampMilli</big>** : returns current mill second timestamp.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#TimestampMilli)]
|
||||||
|
- **<big>TimestampMicro</big>** : returns current micro second timestamp.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#TimestampMicro)]
|
||||||
|
- **<big>TimestampNano</big>** : returns current nano second timestamp.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#TimestampNano)]
|
||||||
|
|
||||||
<h3 id="Datastructure"> 8. Datastructure package constains some common data structure. eg. list, linklist, stack, queue, set, tree, graph. <a href="#index">index</span></h3>
|
<h3 id="Datastructure"> 8. Datastructure package constains some common data structure. eg. list, linklist, stack, queue, set, tree, graph. <a href="#index">index</span></h3>
|
||||||
|
|
||||||
@@ -796,6 +824,24 @@ import "github.com/duke-git/lancet/v2/maputil"
|
|||||||
- **<big>IsDisjoint</big>** : check two map are disjoint if they have no keys in common.
|
- **<big>IsDisjoint</big>** : check two map are disjoint if they have no keys in common.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#IsDisjoint)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#IsDisjoint)]
|
||||||
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
|
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
|
||||||
|
- **<big>HasKey</big>** : checks if map has key or not.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#HasKey)]
|
||||||
|
- **<big>NewConcurrentMap</big>** : creates a ConcurrentMap with specific shard count.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#NewConcurrentMap)]
|
||||||
|
- **<big>ConcurrentMap_Set</big>** : set the value for a key.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#ConcurrentMap_Set)]
|
||||||
|
- **<big>ConcurrentMap_Get</big>** : get the value stored in the map for a key, or nil if no.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#ConcurrentMap_Get)]
|
||||||
|
- **<big>ConcurrentMap_GetOrSet</big>** : returns the existing value for the key if present.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#ConcurrentMap_GetOrSet)]
|
||||||
|
- **<big>ConcurrentMap_Delete</big>** : delete the value for a key.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#ConcurrentMap_Delete)]
|
||||||
|
- **<big>ConcurrentMap_GetAndDelete</big>** :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/maputil.md#ConcurrentMap_GetAndDelete)]
|
||||||
|
- **<big>ConcurrentMap_Has</big>** : checks if map has the value for a key.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#ConcurrentMap_Has)]
|
||||||
|
- **<big>ConcurrentMap_Range</big>** : 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/maputil.md#ConcurrentMap_Range)]
|
||||||
|
|
||||||
<h3 id="Mathutil"> 13. Mathutil package implements some functions for math calculation. <a href="#index">index</span></h3>
|
<h3 id="Mathutil"> 13. Mathutil package implements some functions for math calculation. <a href="#index">index</span></h3>
|
||||||
|
|
||||||
@@ -1247,6 +1293,8 @@ import "github.com/duke-git/lancet/v2/slice"
|
|||||||
- **<big>KeyBy</big>** : converts a slice to a map based on a callback function.
|
- **<big>KeyBy</big>** : converts a slice to a map based on a callback function.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#KeyBy)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#KeyBy)]
|
||||||
[[play](https://go.dev/play/p/uXod2LWD1Kg)]
|
[[play](https://go.dev/play/p/uXod2LWD1Kg)]
|
||||||
|
- **<big>Join</big>** : join the slice item with specify separator.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#Join)]
|
||||||
|
|
||||||
<h3 id="Stream"> 19. Stream package implements a sequence of elements supporting sequential and operations. this package is an experiment to explore if stream in go can work as the way java does. its function is very limited. <a href="#index">index</a></h3>
|
<h3 id="Stream"> 19. Stream package implements a sequence of elements supporting sequential and operations. this package is an experiment to explore if stream in go can work as the way java does. its function is very limited. <a href="#index">index</a></h3>
|
||||||
|
|
||||||
|
|||||||
@@ -387,32 +387,50 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
|||||||
- **<big>HmacMd5</big>** : 返回字符串 md5 hmac 值。
|
- **<big>HmacMd5</big>** : 返回字符串 md5 hmac 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacMd5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacMd5)]
|
||||||
[[play](https://go.dev/play/p/uef0q1fz53I)]
|
[[play](https://go.dev/play/p/uef0q1fz53I)]
|
||||||
|
- **<big>HmacMd5WithBase64</big>** : 获取字符串 md5 hmac base64 字符串值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacMd5WithBase64)]
|
||||||
- **<big>HmacSha1</big>** : 返回字符串 sha1 hmac 值。
|
- **<big>HmacSha1</big>** : 返回字符串 sha1 hmac 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha1)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha1)]
|
||||||
[[play](https://go.dev/play/p/1UI4oQ4WXKM)]
|
[[play](https://go.dev/play/p/1UI4oQ4WXKM)]
|
||||||
|
- **<big>HmacSha1WithBase64</big>** : 获取字符串的 sha1 base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha1WithBase64)]
|
||||||
- **<big>HmacSha256</big>** : 返回字符串 sha256 hmac 值。
|
- **<big>HmacSha256</big>** : 返回字符串 sha256 hmac 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha256)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha256)]
|
||||||
[[play](https://go.dev/play/p/HhpwXxFhhC0)]
|
[[play](https://go.dev/play/p/HhpwXxFhhC0)]
|
||||||
|
- **<big>HmacSha256WithBase64</big>** : 获取字符串 sha256 hmac base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha256WithBase64)]
|
||||||
- **<big>HmacSha512</big>** : 返回字符串 sha256 hmac 值。
|
- **<big>HmacSha512</big>** : 返回字符串 sha256 hmac 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha512)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha512)]
|
||||||
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
||||||
|
- **<big>HmacSha512WithBase64</big>** : 获取字符串 sha512 hmac base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha512WithBase64)]
|
||||||
- **<big>Md5Byte</big>** : 返回 byte slice 的 md5 值.
|
- **<big>Md5Byte</big>** : 返回 byte slice 的 md5 值.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5Byte)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5Byte)]
|
||||||
[[play](https://go.dev/play/p/suraalH8lyC)]
|
[[play](https://go.dev/play/p/suraalH8lyC)]
|
||||||
|
- **<big>Md5ByteWithBase64</big>** : 获取 byte slice 的 md5 base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5ByteWithBase64)]
|
||||||
- **<big>Md5String</big>** : 返回字符串 md5 值。
|
- **<big>Md5String</big>** : 返回字符串 md5 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5String)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5String)]
|
||||||
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
||||||
|
- **<big>Md5StringWithBase64</big>** : 获取字符串 md5 base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5StringWithBase64)]
|
||||||
- **<big>Md5File</big>** : 返回文件 md5 值。
|
- **<big>Md5File</big>** : 返回文件 md5 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5File)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5File)]
|
||||||
- **<big>Sha1</big>** : 返回字符串 sha1 哈希值。
|
- **<big>Sha1</big>** : 返回字符串 sha1 哈希值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha1)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha1)]
|
||||||
[[play](https://go.dev/play/p/_m_uoD1deMT)]
|
[[play](https://go.dev/play/p/_m_uoD1deMT)]
|
||||||
|
- **<big>Sha1WithBase64</big>** : 获取字符串 sha1 base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha1WithBase64)]
|
||||||
- **<big>Sha256</big>** :返回字符串 sha256 哈希值。
|
- **<big>Sha256</big>** :返回字符串 sha256 哈希值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha256)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha256)]
|
||||||
[[play](https://go.dev/play/p/tU9tfBMIAr1)]
|
[[play](https://go.dev/play/p/tU9tfBMIAr1)]
|
||||||
|
- **<big>Sha256WithBase64</big>** : 获取字符串 sha256 base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha256WithBase64)]
|
||||||
- **<big>Sha512</big>** : 返回字符串 sha512 哈希值。
|
- **<big>Sha512</big>** : 返回字符串 sha512 哈希值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha512)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha512)]
|
||||||
[[play](https://go.dev/play/p/3WsvLYZxsHa)]
|
[[play](https://go.dev/play/p/3WsvLYZxsHa)]
|
||||||
|
- **<big>Sha512WithBase64</big>** : 获取字符串 sha512 base64 值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Sha512WithBase64)]
|
||||||
- **<big>GenerateRsaKey</big>** : 在当前目录下创建 rsa 私钥文件和公钥文件。
|
- **<big>GenerateRsaKey</big>** : 在当前目录下创建 rsa 私钥文件和公钥文件。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#GenerateRsaKey)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#GenerateRsaKey)]
|
||||||
[[play](https://go.dev/play/p/zutRHrDqs0X)]
|
[[play](https://go.dev/play/p/zutRHrDqs0X)]
|
||||||
@@ -545,6 +563,16 @@ import "github.com/duke-git/lancet/v2/datetime"
|
|||||||
- **<big>IsWeekend</big>** : 判断日期是否是周末。
|
- **<big>IsWeekend</big>** : 判断日期是否是周末。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#IsWeekend)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#IsWeekend)]
|
||||||
[[play](https://go.dev/play/p/cupRM5aZOIY)]
|
[[play](https://go.dev/play/p/cupRM5aZOIY)]
|
||||||
|
- **<big>NowDateOrTime</big>** : 根据指定的格式和时区返回当前时间字符串。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#NowDateOrTime)]
|
||||||
|
- **<big>Timestamp</big>** : 返回当前秒级时间戳。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#Timestamp)]
|
||||||
|
- **<big>TimestampMilli</big>** : 返回当前毫秒级时间戳。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#TimestampMilli)]
|
||||||
|
- **<big>TimestampMicro</big>** : 返回当前微秒级时间戳。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#TimestampMicro)]
|
||||||
|
- **<big>TimestampNano</big>** : 返回当前纳秒级时间戳。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#TimestampNano)]
|
||||||
|
|
||||||
<h3 id="Datastructure"> 8. datastructure 包含一些普通的数据结构实现。例如:list, linklist, stack, queue, set, tree, graph。 <a href="#index">回到目录</a></h3>
|
<h3 id="Datastructure"> 8. datastructure 包含一些普通的数据结构实现。例如:list, linklist, stack, queue, set, tree, graph。 <a href="#index">回到目录</a></h3>
|
||||||
|
|
||||||
@@ -778,26 +806,44 @@ import "github.com/duke-git/lancet/v2/maputil"
|
|||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#Values)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#Values)]
|
||||||
[[play](https://go.dev/play/p/CBKdUc5FTW6)]
|
[[play](https://go.dev/play/p/CBKdUc5FTW6)]
|
||||||
- **<big>ValuesBy</big>** : 创建一个切片,其元素是每个 map 的 value 调用 mapper 函数的结果。
|
- **<big>ValuesBy</big>** : 创建一个切片,其元素是每个 map 的 value 调用 mapper 函数的结果。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN#ValuesBy)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ValuesBy)]
|
||||||
[[play](https://go.dev/play/p/sg9-oRidh8f)]
|
[[play](https://go.dev/play/p/sg9-oRidh8f)]
|
||||||
- **<big>MapKeys</big>** : 操作 map 的每个 key,然后转为新的 map。
|
- **<big>MapKeys</big>** : 操作 map 的每个 key,然后转为新的 map。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN#MapKeys)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#MapKeys)]
|
||||||
[[play](https://go.dev/play/p/8scDxWeBDKd)]
|
[[play](https://go.dev/play/p/8scDxWeBDKd)]
|
||||||
- **<big>MapValues</big>** : 操作 map 的每个 value,然后转为新的 map。
|
- **<big>MapValues</big>** : 操作 map 的每个 value,然后转为新的 map。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN#MapValues)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#MapValues)]
|
||||||
[[play](https://go.dev/play/p/g92aY3fc7Iw)]
|
[[play](https://go.dev/play/p/g92aY3fc7Iw)]
|
||||||
- **<big>Entries</big>** : 将 map 转换为键/值对切片。
|
- **<big>Entries</big>** : 将 map 转换为键/值对切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN#Entries)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#Entries)]
|
||||||
[[play](https://go.dev/play/p/Ltb11LNcElY)]
|
[[play](https://go.dev/play/p/Ltb11LNcElY)]
|
||||||
- **<big>FromEntries</big>** : 基于键/值对的切片创建 map。
|
- **<big>FromEntries</big>** : 基于键/值对的切片创建 map。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN#FromEntries)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#FromEntries)]
|
||||||
[[play](https://go.dev/play/p/fTdu4sCNjQO)]
|
[[play](https://go.dev/play/p/fTdu4sCNjQO)]
|
||||||
- **<big>Transform</big>** : 将 map 转换为其他类型的 map。
|
- **<big>Transform</big>** : 将 map 转换为其他类型的 map。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN#Transform)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#Transform)]
|
||||||
[[play](https://go.dev/play/p/P6ovfToM3zj)]
|
[[play](https://go.dev/play/p/P6ovfToM3zj)]
|
||||||
- **<big>IsDisjoint</big>** : 验证两个 map 是否具有不同的 key。
|
- **<big>IsDisjoint</big>** : 验证两个 map 是否具有不同的 key。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#IsDisjoint)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#IsDisjoint)]
|
||||||
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
|
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
|
||||||
|
- **<big>HasKey</big>** : 检查map是否包含某个key。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#HasKey)]
|
||||||
|
- **<big>NewConcurrentMap</big>** : ConcurrentMap协程安全的map结构。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#NewConcurrentMap)]
|
||||||
|
- **<big>ConcurrentMap_Set</big>** : 在map中设置key和value。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ConcurrentMap_Set)]
|
||||||
|
- **<big>ConcurrentMap_Get</big>** : 根据key获取value, 如果不存在key,返回零值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ConcurrentMap_Get)]
|
||||||
|
- **<big>ConcurrentMap_GetOrSet</big>** : 返回键的现有值(如果存在),否则,设置key并返回给定值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ConcurrentMap_GetOrSet)]
|
||||||
|
- **<big>ConcurrentMap_Delete</big>** : 删除key。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ConcurrentMap_Delete)]
|
||||||
|
- **<big>ConcurrentMap_GetAndDelete</big>** :获取key,然后删除。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ConcurrentMap_GetAndDelete)]
|
||||||
|
- **<big>ConcurrentMap_Has</big>** : 验证是否包含key。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ConcurrentMap_Has)]
|
||||||
|
- **<big>ConcurrentMap_Range</big>** : 为map中每个键和值顺序调用迭代器。 如果iterator返回false,则停止迭代。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil_zh-CN.md#ConcurrentMap_Range)]
|
||||||
|
|
||||||
<h3 id="Mathutil"> 13. mathutil 包实现了一些数学计算的函数。 <a href="#index">回到目录</a></h3>
|
<h3 id="Mathutil"> 13. mathutil 包实现了一些数学计算的函数。 <a href="#index">回到目录</a></h3>
|
||||||
|
|
||||||
@@ -969,7 +1015,13 @@ import "github.com/duke-git/lancet/v2/pointer"
|
|||||||
[[play](https://go.dev/play/p/HFd70x4DrMj)]
|
[[play](https://go.dev/play/p/HFd70x4DrMj)]
|
||||||
- **<big>Unwrap</big>** : 返回传入指针指向的值。
|
- **<big>Unwrap</big>** : 返回传入指针指向的值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/pointer_zh-CN.md#Unwrap)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/pointer_zh-CN.md#Unwrap)]
|
||||||
[[play](https://go.dev/play/p/cgeu3g7cjWb)]
|
[[play](https://go.dev/play/p/cgeu3g7cjWb)
|
||||||
|
- **<big>UnwarpOr</big>** : 返回指针的值,如果指针为零值,则返回 fallback。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/pointer_zh-CN.md#UnwrapOr)]
|
||||||
|
[[play](https://go.dev/play/p/mmNaLC38W8C)]
|
||||||
|
- **<big>UnwarpOrDefault</big>** : 返回指针的值,如果指针为零值,则返回相应零值。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/pointer_zh-CN.md#UnwrapOrDefault)]
|
||||||
|
[[play](https://go.dev/play/p/ZnGIHf8_o4E)]
|
||||||
|
|
||||||
<h3 id="Random"> 16. random 随机数生成器包,可以生成随机[]bytes, int, string。 <a href="#index">回到目录</a></h3>
|
<h3 id="Random"> 16. random 随机数生成器包,可以生成随机[]bytes, int, string。 <a href="#index">回到目录</a></h3>
|
||||||
|
|
||||||
@@ -1243,6 +1295,8 @@ import "github.com/duke-git/lancet/v2/slice"
|
|||||||
- **<big>KeyBy</big>** :将切片每个元素调用函数后转为 map。
|
- **<big>KeyBy</big>** :将切片每个元素调用函数后转为 map。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#KeyBy)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#KeyBy)]
|
||||||
[[play](https://go.dev/play/p/uXod2LWD1Kg)]
|
[[play](https://go.dev/play/p/uXod2LWD1Kg)]
|
||||||
|
- **<big>Join</big>** : 用指定的分隔符链接切片元素。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#Join)]
|
||||||
|
|
||||||
<h3 id="Stream"> 19. stream 流,该包仅验证简单的 stream 实现,功能有限。 <a href="#index">回到目录</a></h3>
|
<h3 id="Stream"> 19. stream 流,该包仅验证简单的 stream 实现,功能有限。 <a href="#index">回到目录</a></h3>
|
||||||
|
|
||||||
@@ -1638,7 +1692,6 @@ import "github.com/duke-git/lancet/v2/tuple"
|
|||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip10)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip10)]
|
||||||
[[play](https://go.dev/play/p/-taQB6Wfre_z)]
|
[[play](https://go.dev/play/p/-taQB6Wfre_z)]
|
||||||
|
|
||||||
|
|
||||||
<h3 id="Validator"> 24. validator 验证器包,包含常用字符串格式验证函数。 <a href="#index">回到目录</a></h3>
|
<h3 id="Validator"> 24. validator 验证器包,包含常用字符串格式验证函数。 <a href="#index">回到目录</a></h3>
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
|||||||
Reference in New Issue
Block a user