add new func & docs error repair (#153)

* feat: add method IsTargetType()

* docs:document error repair
This commit is contained in:
duckjiangwei authored and GitHub committed 2023-12-28 10:27:32 +08:00
1 parent 0bc7b83e59
commit 11214986cc
6 files changed
+137 -25

No files matched your search

+5
View File
@@ -68,6 +68,11 @@ func (f *Field) IsSlice() bool {
return k == reflect.Slice
}
// IsTargetType check if a struct field type is target type or not
func (f *Field) IsTargetType(targetType reflect.Kind) bool {
return f.rvalue.Kind() == targetType
}
// mapValue covert field value to map
func (f *Field) mapValue(value any) any {
val := pointer.ExtractPointer(value)