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