mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-13 17:22:27 +08:00
fix: fix get tag failed
This commit is contained in:
@@ -6,9 +6,11 @@ package maputil
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/exp/constraints"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/exp/constraints"
|
||||||
|
|
||||||
"github.com/duke-git/lancet/v2/slice"
|
"github.com/duke-git/lancet/v2/slice"
|
||||||
)
|
)
|
||||||
@@ -379,7 +381,7 @@ func getFieldNameByJsonTag(structObj any, jsonTag string) string {
|
|||||||
tag := field.Tag
|
tag := field.Tag
|
||||||
name := tag.Get("json")
|
name := tag.Get("json")
|
||||||
|
|
||||||
if name == jsonTag {
|
if strings.Contains(name, jsonTag) {
|
||||||
return field.Name
|
return field.Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user