Skip to content

List/Map types not supported in properties #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sankarvj opened this issue Aug 11, 2020 · 2 comments · Fixed by #47 or #49
Closed

List/Map types not supported in properties #30

sankarvj opened this issue Aug 11, 2020 · 2 comments · Fixed by #47 or #49
Assignees
Labels
bug Something isn't working

Comments

@sankarvj
Copy link

sankarvj commented Aug 11, 2020

version : v2.0.2

issue: I'm not able to add list/map types as the property value.

example:

       japan := rg.Node{
		Label: "country",
		Properties: map[string]interface{}{
			"name":   "Japan",
			"states": []string{"Kanto", "Chugoku"},
		},
	}

error:

Unrecognized type to convert to string

the following block in utils.go throws the error during the properties encoding.

	switch i.(type) {
	case string:
		s := i.(string)
		return strconv.Quote(s)
	case int:
		return strconv.Itoa(i.(int))
	case float64:
		return strconv.FormatFloat(i.(float64), 'f', -1, 64)
	case bool:
		return strconv.FormatBool(i.(bool))
	case []interface {}:
		arr := i.([]interface{})
		return arrayToString(arr)
	default:
		panic("Unrecognized type to convert to string")
	}

Since the list/map is working via the Redis-CLI. I suspect this as a client library bug.

@swilly22 swilly22 added the bug Something isn't working label Aug 12, 2020
@swilly22 swilly22 self-assigned this Aug 12, 2020
@lorantpapp
Copy link

Hi,

Is there any fix available for this bug? Specially interested in the fix after learning that starting from Redis graph 2.4 map datatypes are supported: "introducing map datatype #1514", RedisGraph/RedisGraph#1514.

BR
Lorant

@AvitalFineRedis AvitalFineRedis linked a pull request May 30, 2021 that will close this issue
@filipecosta90
Copy link
Contributor

filipecosta90 commented Jun 2, 2021

reopening due to the requirement of supporting []string. map support has already been addressed by @AvitalFineRedis on #47

@filipecosta90 filipecosta90 reopened this Jun 2, 2021
jeffreylovitz pushed a commit that referenced this issue Jun 2, 2021
* [add] Added support for []string on ToString()

* [add] Included test case of issue #30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants