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

refactor: add function comment for tag.go

This commit is contained in:
dudaodong
2023-03-15 17:43:47 +08:00
parent f79693804b
commit 7261b281ad
4 changed files with 14 additions and 4 deletions

View File

@@ -1,10 +1,12 @@
package structutil
import (
"github.com/duke-git/lancet/v2/pointer"
"reflect"
"github.com/duke-git/lancet/v2/pointer"
)
// Field is abstract struct field for provide several high level functions
type Field struct {
Struct
field reflect.StructField
@@ -59,11 +61,13 @@ func (f *Field) Kind() reflect.Kind {
return f.rvalue.Kind()
}
// IsSlice check if a struct field type is slice or not
func (f *Field) IsSlice() bool {
k := f.rvalue.Kind()
return k == reflect.Slice
}
// MapValue conver field value to map.
func (f *Field) MapValue(value any) any {
val := pointer.ExtractPointer(value)
v := reflect.ValueOf(val)