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

[structs] change package structutil to structs (#81)

* refactor package structutil to structs

* add structs package zh-CN docs
This commit is contained in:
zm
2023-03-15 19:14:19 +08:00
committed by GitHub
parent 7261b281ad
commit 5e66bc6227
12 changed files with 594 additions and 26 deletions

View File

@@ -11,7 +11,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/duke-git/lancet/v2/structutil"
"github.com/duke-git/lancet/v2/structs"
"math"
"reflect"
"strconv"
@@ -235,7 +235,7 @@ func ToMap[T any, K comparable, V any](array []T, iteratee func(T) (K, V)) map[K
// map key is specified same as struct field tag `json` value.
// Play: https://go.dev/play/p/KYGYJqNUBOI
func StructToMap(value any) (map[string]any, error) {
return structutil.ToMap(value)
return structs.ToMap(value)
}
// MapToSlice convert map to slice based on iteratee function.