func isSingleValue(data reflect.Value) bool { if data.IsValid() == false { return true } dataKind := language.GetTypeKind(data.Type()) if dataKind == language.TypeKind.ARRAY || dataKind == language.TypeKind.MAP { return false } else if dataKind == language.TypeKind.INTERFACE || dataKind == language.TypeKind.PTR { return isSingleValue(data.Elem()) } else { return true } }
func encodeQueryInner(prefix string, data reflect.Value) (string, error) { if data.IsValid() == false { return "", nil } dataType := data.Type() dataKind := language.GetTypeKind(dataType) if dataKind == language.TypeKind.BOOL || dataKind == language.TypeKind.INT || dataKind == language.TypeKind.UINT || dataKind == language.TypeKind.FLOAT || dataKind == language.TypeKind.STRING { return encodeQueryInnerSingle(prefix, fmt.Sprintf("%v", data)) } else if dataKind == language.TypeKind.ARRAY { return encodeQueryInnerArray(prefix, data) } else if dataKind == language.TypeKind.MAP { return encodeQueryInnerMap(prefix, data) } else if dataKind == language.TypeKind.PTR || dataKind == language.TypeKind.INTERFACE { return encodeQueryInner(prefix, data.Elem()) } else { return "", errors.New("invalid type " + dataType.String()) } }