grammes icon indicating copy to clipboard operation
grammes copied to clipboard

"odd number of parameters"

Open asicerik opened this issue 3 years ago • 0 comments

Hello - I am trying to use AddVertexByStruct with manually created properties. It works fine with single valued properties. If I try to add multiple values it fails with the "odd number of parameters" error.

Here is the code I am using to create the properties: props := make([]model.Property, slice.Len()) for j := 0; j < slice.Len(); j++ { props[j] = grammes.NewProperty(graphName, slice.Index(j).Interface()) } vertex.Value.Properties[graphName] = props Am I doing this wrong, or is there a bug? I think this is because it creates the parameter strings using the key + values where it should put the key in every time. The code in question is: for key, vals := range vertex.Value.Properties { properties = append(properties, key) for _, val := range vals { properties = append(properties, val.Value.Value.Value) } }

This will result in a string like "key", "val1", "val2", etc. instead of "key", "val1", "key", "val2" which is what AddVertex seems to expect.

asicerik avatar Sep 11 '20 20:09 asicerik