diff --git a/types/data.go b/types/data.go index b18195d..cca7560 100644 --- a/types/data.go +++ b/types/data.go @@ -31,11 +31,9 @@ func (data Data) GetSlice(key string) (res Slice, err error) { return nil, err } - switch value := value.(type) { + switch v := value.(type) { case []interface{}: - return value, nil - case Slice: - return value, nil + return v, nil default: return nil, ErrFormat } @@ -125,11 +123,9 @@ func (data Data) GetData(key string) (Data, error) { return nil, err } - switch value := value.(type) { + switch v := value.(type) { case map[string]interface{}: - return Data(value), nil - case Data: - return value, nil + return v, nil default: return nil, ErrFormat } @@ -149,9 +145,9 @@ func (data Data) GetDataSlice(key string) ([]Data, error) { } var list []Data - for _, v := range values { - switch v := v.(type) { - case Data: + for _, value := range values { + switch v := value.(type) { + case map[string]interface{}: list = append(list, v) default: return nil, ErrFormat