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

doc: add go playground demo

This commit is contained in:
dudaodong
2024-03-06 14:52:35 +08:00
parent 036847577d
commit 1b31014f81
14 changed files with 86 additions and 56 deletions

View File

@@ -891,7 +891,7 @@ func main() {
func ToStdBase64(value any) string
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/_fLJqJD3NMo)</span></b>
```go
package main
@@ -963,7 +963,7 @@ func main() {
func ToUrlBase64(value any) string
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/C_d0GlvEeUR)</span></b>
```go
package main
@@ -1032,7 +1032,7 @@ func main() {
func ToRawStdBase64(value any) string
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/wSAr3sfkDcv)</span></b>
```go
package main
@@ -1045,7 +1045,7 @@ import (
func main() {
stringVal := "hello"
afterEncode = convertor.ToRawStdBase64(stringVal)
afterEncode := convertor.ToRawStdBase64(stringVal)
fmt.Println(afterEncode)
byteSliceVal := []byte("hello")
@@ -1096,7 +1096,7 @@ func main() {
func ToRawUrlBase64(value any) string
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/HwdDPFcza1O)</span></b>
```go
package main
@@ -1109,7 +1109,7 @@ import (
func main() {
stringVal := "hello"
afterEncode = convertor.ToRawUrlBase64(stringVal)
afterEncode := convertor.ToRawUrlBase64(stringVal)
fmt.Println(afterEncode)
byteSliceVal := []byte("hello")
@@ -1132,11 +1132,11 @@ func main() {
fmt.Println(afterEncode)
boolVal := true
afterEncode = convertor.ToRawStdBase64(boolVal)
afterEncode = convertor.ToRawUrlBase64(boolVal)
fmt.Println(afterEncode)
errVal := errors.New("err")
afterEncode = convertor.ToRawStdBase64(errVal)
afterEncode = convertor.ToRawUrlBase64(errVal)
fmt.Println(afterEncode)
// Output:

View File

@@ -167,7 +167,7 @@ func main() {
### <span id="CopyDir">CopyDir</span>
<p>copy src directory to dst directory, it will copy all files and directories recursively. the access permission will be the same as the source directory. if dstPath exists, it will return an error.</p>
<p>Copy src directory to dst directory, it will copy all files and directories recursively. the access permission will be the same as the source directory. if dstPath exists, it will return an error.</p>
<b>Signature:</b>
@@ -974,7 +974,7 @@ func main() {
func ChunkRead(file *os.File, offset int64, size int, bufPool *sync.Pool) ([]string, error)
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/r0hPmKWhsgf)</span></b>
```go
package main
@@ -1033,7 +1033,7 @@ func main() {
func ParallelChunkRead(filePath string, linesCh chan<- []string, chunkSizeMB, maxGoroutine int) error
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/teMXnCsdSEw)</span></b>
```go
package main

View File

@@ -508,7 +508,7 @@ func main() {
func CeilToFloat[T constraints.Float | constraints.Integer](x T, n int) float64
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/8hOeSADZPCo)</span></b>
```go
package main
@@ -544,7 +544,7 @@ func main() {
func CeilToString[T constraints.Float | constraints.Integer](x T, n int) string
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/wy5bYEyUKKG)</span></b>
```go
package main
@@ -577,10 +577,10 @@ func main() {
<b>Signature:</b>
```go
func CeilToString[T constraints.Float | constraints.Integer](x T, n int) string
func FloorToFloat[T constraints.Float | constraints.Integer](x T, n int) float64
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/vbCBrQHZEED)</span></b>
```go
package main
@@ -613,10 +613,10 @@ func main() {
<b>Signature:</b>
```go
func CeilToString[T constraints.Float | constraints.Integer](x T, n int) string
func FloorToString[T constraints.Float | constraints.Integer](x T, n int) string
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/Qk9KPd2IdDb)</span></b>
```go
package main
@@ -1130,7 +1130,7 @@ func main() {
### <span id="Div">Div</span>
<p>returns the result of x divided by y.</p>
<p>Returns the result of x divided by y.</p>
<b>Signature:</b>
@@ -1138,7 +1138,7 @@ func main() {
func Div[T constraints.Float | constraints.Integer](x T, y T) float64
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/WLxDdGXXYat)</span></b>
```go
package main

View File

@@ -1477,7 +1477,7 @@ func main() {
func SubInBetween(str string, start string, end string) string
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/EDbaRvjeNsv)</span></b>
```go
import (
@@ -1507,10 +1507,10 @@ func main() {
<b>Signature:</b>
```go
HammingDistance(a, b string) (int, error)
func HammingDistance(a, b string) (int, error)
```
<b>Example:</b>
<b>Example:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/glNdQEA9HUi)</span></b>
```go
import (