Skip to content

Commit

Permalink
Simplify Get method.
Browse files Browse the repository at this point in the history
Refs #586
  • Loading branch information
echlebek committed Nov 23, 2017
1 parent 90f4ca2 commit d9d8234
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions types/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,10 @@ func (p AnyParameters) Get(name string) (interface{}, error) {
switch any.ValueType() {
case jsoniter.InvalidValue:
return nil, fmt.Errorf("dynamic: %s", any.LastError())
case jsoniter.StringValue:
return any.ToString(), nil
case jsoniter.NumberValue:
return any.ToFloat64(), nil
case jsoniter.NilValue:
return nil, nil
case jsoniter.BoolValue:
return any.ToBool(), nil
case jsoniter.ArrayValue:
return any.GetInterface(), any.LastError()
case jsoniter.ObjectValue:
return AnyParameters{any: any}, any.LastError()
default:
return nil, fmt.Errorf("dynamic: unrecognized value type! %d", p.any.ValueType())
return any.GetInterface(), any.LastError()
}

}
Expand Down

0 comments on commit d9d8234

Please sign in to comment.