func sortParams(q map[string]interface{}) map[int]map[string]interface{} { sorted := map[int]map[string]interface{}{} for i, v := range q { num, err := strconv.Atoi(string(i[0])) nummed := false if err == nil { nummed = true } else { num = 0 } if nummed { i = i[1:] } if _, has := sorted[num]; !has { sorted[num] = map[string]interface{}{} } if _, ok := v.([]interface{}); ok { for _, x := range v.([]interface{}) { convert.MapAdd(sorted[num], i, x) } } else { sorted[num][i] = v } } return sorted }
func EncodeQueries(queries []map[string]interface{}, ignore_lone_id bool) map[string]interface{} { u := map[string]interface{}{} dec := 0 for i, v := range queries { if ignore_lone_id && loneId(v) { dec++ continue } var prefix string if i-dec != 0 { prefix = strconv.Itoa(i - dec) } for j, x := range v { if _, yepp := x.([]interface{}); yepp { for _, z := range x.([]interface{}) { convert.MapAdd(u, prefix+j, z) } } else { u[prefix+j] = x } } } return u }
func (v Values) Add(i string, value interface{}) { convert.MapAdd(v, i, value) }