1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 15:52:27 +08:00

add new func & docs error repair (#153)

* feat: add method IsTargetType()

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

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)