Skip to content

List/Map types not supported in properties #30

Closed
@sankarvj

Description

@sankarvj

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions