1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-13 01:02:28 +08:00

update doc

This commit is contained in:
dudaodong
2024-12-04 10:40:18 +08:00
parent e1e15883e9
commit 4595a94b4c
14 changed files with 342 additions and 196 deletions

View File

@@ -45,7 +45,7 @@ import (
- [ToUrlBase64](#ToUrlBase64)
- [ToRawStdBase64](#ToRawStdBase64)
- [ToRawUrlBase64](#ToRawUrlBase64)
- [ToBigInt](#ToBigInt)
<div STYLE="page-break-after: always;"></div>
@@ -454,7 +454,7 @@ func main() {
<b>Signature:</b>
```go
func EncodeByte(data any) ([]byte, error)
func EncodeByte(data interface{}) ([]byte, error)
```
<b>Example:</b>
@@ -480,7 +480,7 @@ func main() {
<b>Signature:</b>
```go
func DecodeByte(data []byte, target any) error
func DecodeByte(data []byte, target interface{}) error
```
<b>Example:</b>
@@ -508,7 +508,7 @@ func main() {
<b>Signature:</b>
```go
func DeepClone[T any](src T) T
func DeepClone[T interface{}](src T) T
```
<b>Example:</b>
@@ -753,7 +753,7 @@ func main() {
<b>Signature:</b>
```go
func ToStdBase64(value any) string
func ToStdBase64(value interface{}) string
```
<b>Example:</b>
@@ -785,7 +785,7 @@ func main() {
afterEncode = convertor.ToStdBase64(intVal)
fmt.Println(afterEncode)
mapVal := map[string]any{"a": "hi", "b": 2, "c": struct {
mapVal := map[string]interface{}{"a": "hi", "b": 2, "c": struct {
A string
B int
}{"hello", 3}}
@@ -825,7 +825,7 @@ func main() {
<b>Signature:</b>
```go
func ToUrlBase64(value any) string
func ToUrlBase64(value interface{}) string
```
<b>Example:</b>
@@ -855,7 +855,7 @@ func main() {
afterEncode = convertor.ToUrlBase64(intVal)
fmt.Println(afterEncode)
mapVal := map[string]any{"a": "hi", "b": 2, "c": struct {
mapVal := map[string]interface{}{"a": "hi", "b": 2, "c": struct {
A string
B int
}{"hello", 3}}
@@ -894,7 +894,7 @@ func main() {
<b>Signature:</b>
```go
func ToRawStdBase64(value any) string
func ToRawStdBase64(value interface{}) string
```
<b>Example:</b>
@@ -921,7 +921,7 @@ func main() {
afterEncode = convertor.ToRawStdBase64(intVal)
fmt.Println(afterEncode)
mapVal := map[string]any{"a": "hi", "b": 2, "c": struct {
mapVal := map[string]interface{}{"a": "hi", "b": 2, "c": struct {
A string
B int
}{"hello", 3}}
@@ -958,7 +958,7 @@ func main() {
<b>Signature:</b>
```go
func ToRawUrlBase64(value any) string
func ToRawUrlBase64(value interface{}) string
```
<b>Example:</b>
@@ -985,7 +985,7 @@ func main() {
afterEncode = convertor.ToRawUrlBase64(intVal)
fmt.Println(afterEncode)
mapVal := map[string]any{"a": "hi", "b": 2, "c": struct {
mapVal := map[string]interface{}{"a": "hi", "b": 2, "c": struct {
A string
B int
}{"hello", 3}}
@@ -1013,4 +1013,34 @@ func main() {
// dHJ1ZQ
// ZXJy
}
```
### <span id="ToBigInt">ToBigInt</span>
<p>Convert value to bigInt.</p>
<b>Signature:</b>
```go
func ToBigInt(v interface{}) (*big.Int, error)
```
<b>Example:</b>
```go
package main
import (
"fmt"
"github.com/duke-git/lancet/convertor"
)
func main() {
n := 9876543210
bigInt, _ := convertor.ToBigInt(n)
fmt.Println(bigInt)
// Output:
// 9876543210
}
```