1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-11 08:12:26 +08:00

doc: add go playground demo

This commit is contained in:
dudaodong
2023-08-01 11:01:57 +08:00
parent 72924d4486
commit bb563724c7
9 changed files with 131 additions and 42 deletions

View File

@@ -395,26 +395,31 @@ import "github.com/duke-git/lancet/v2/cryptor"
[[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)]
[[play](https://go.dev/play/p/47JmmGrnF7B)]
- **<big>HmacSha256</big>** : return the hmac hash of string use sha256.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha256)]
[[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)]
[[play](https://go.dev/play/p/EKbkUvPTLwO)]
- **<big>HmacSha512</big>** : return the hmac hash of string use sha512.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha512)]
[[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)]
[[play](https://go.dev/play/p/c6dSe3E2ydU)]
- **<big>Md5Byte</big>** : return the md5 string of byte slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5Byte)]
[[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)]
[[play](https://go.dev/play/p/Tcb-Z7LN2ax)]
- **<big>Md5String</big>** : return the md5 value of string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5String)]
[[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)]
[[play](https://go.dev/play/p/Lx4gH7Vdr5_y)]
- **<big>Md5File</big>** : return the md5 value of file.
[[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 base64 string.
@@ -422,16 +427,19 @@ import "github.com/duke-git/lancet/v2/cryptor"
[[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)]
[[play](https://go.dev/play/p/fSyx-Gl2l2-)]
- **<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)]
[[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)]
[[play](https://go.dev/play/p/85IXJHIal1k)]
- **<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)]
[[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)]
[[play](https://go.dev/play/p/q_fY2rA-k5I)]
- **<big>GenerateRsaKey</big>** : create rsa private and public pemo file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#GenerateRsaKey)]
[[play](https://go.dev/play/p/zutRHrDqs0X)]
@@ -563,14 +571,19 @@ import "github.com/duke-git/lancet/v2/datetime"
[[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)]
[[play](https://go.dev/play/p/EZ-begEjtT0)]
- **<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)]
[[play](https://go.dev/play/p/4gvEusOTu1T)]
- **<big>TimestampMicro</big>** : returns current micro second timestamp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#TimestampMicro)]
[[play](https://go.dev/play/p/2maANglKHQE)]
- **<big>TimestampNano</big>** : returns current nano second timestamp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#TimestampNano)]
[[play](https://go.dev/play/p/A9Oq_COrcCF)]
<h3 id="Datastructure"> 8. Datastructure package constains some common data structure. eg. list, linklist, stack, queue, set, tree, graph. &nbsp; &nbsp; &nbsp; &nbsp;<a href="#index">index</span></h3>
@@ -826,22 +839,32 @@ import "github.com/duke-git/lancet/v2/maputil"
[[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)]
[[play](https://go.dev/play/p/isZZHOsDhFc)]
- **<big>NewConcurrentMap</big>** : creates a ConcurrentMap with specific shard count.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#NewConcurrentMap)]
[[play](https://go.dev/play/p/3PenTPETJT0)]
- **<big>ConcurrentMap_Set</big>** : set the value for a key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#ConcurrentMap_Set)]
[[play](https://go.dev/play/p/3PenTPETJT0)]
- **<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)]
[[play](https://go.dev/play/p/3PenTPETJT0)]
- **<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)]
[[play](https://go.dev/play/p/aDcDApOK01a)]
- **<big>ConcurrentMap_Delete</big>** : delete the value for a key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/maputil.md#ConcurrentMap_Delete)]
[[play](https://go.dev/play/p/uTIJZYhpVMS)]
- **<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)]
[[play](https://go.dev/play/p/ZyxeIXSZUiM)]
- **<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)]
[[play](https://go.dev/play/p/C8L4ul9TVwf)]
- **<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)]
[[play](https://go.dev/play/p/iqcy7P8P0Pr)]
<h3 id="Mathutil"> 13. Mathutil package implements some functions for math calculation. &nbsp; &nbsp; &nbsp; &nbsp;<a href="#index">index</span></h3>
@@ -1295,6 +1318,8 @@ import "github.com/duke-git/lancet/v2/slice"
[[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)]
[[play](https://go.dev/play/p/huKzqwNDD7V)]
<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. &nbsp; &nbsp; &nbsp; &nbsp;<a href="#index">index</a></h3>