|
@@ -3,6 +3,7 @@ package value
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "log"
|
|
|
"reflect"
|
|
|
"strconv"
|
|
|
"strings"
|
|
@@ -62,6 +63,25 @@ func (s *Value) Setup(val interface{}) (res bool) {
|
|
|
res = true
|
|
|
}
|
|
|
}
|
|
|
+ case reflect.Slice:
|
|
|
+ {
|
|
|
+ log.Println("Slice")
|
|
|
+ slType := rType.Elem()
|
|
|
+ if rr.Kind() == reflect.Slice {
|
|
|
+ slRes := reflect.MakeSlice(slType, rr.Len(), rr.Cap())
|
|
|
+ for i := 0; i < rl.Len(); i++ {
|
|
|
+ if val := rl.Index(i); val.CanConvert(slType) {
|
|
|
+ slRes.Index(i).Set(val.Convert(slType))
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rr.Elem().Set(slRes)
|
|
|
+ res = true
|
|
|
+ } else if rl.Kind() == reflect.String {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
default:
|
|
|
// json
|
|
|
i := reflect.New(rr.Elem().Type()).Interface()
|