diff --git a/reflect.go b/reflect.go index d67c24a..26a1da3 100644 --- a/reflect.go +++ b/reflect.go @@ -104,6 +104,10 @@ func (rt *ReflectType) fillFieldType(field *StructField, dataType reflect.Type) field.Type = reflect.String case reflect.Struct: field.Type = reflect.Struct + case reflect.Slice: + field.Type = reflect.Slice + case reflect.Map: + field.Type = reflect.Map case reflect.Ptr: field.IsPtr = true // 指针再次判断基础类型 @@ -285,6 +289,28 @@ func (rv *ReflectValue) isZeroInputFieldValue(reflectValue reflect.Value, fieldI } return true } + case reflect.Map: + if nil == inputVal { + return true + } + var m map[interface{}]interface{} + if err := util.ConvertAssign(&m, inputVal); nil == err { + if len(m) != 0 { + return false + } + return true + } + case reflect.Slice: + if nil == inputVal { + return true + } + var sl []interface{} + if err := util.ConvertAssign(&sl, inputVal); nil == err { + if len(sl) != 0 { + return false + } + return true + } case reflect.Interface: if inputVal == nil { return true