Skip to content
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

"odd number of parameters" #32

Open
asicerik opened this issue Sep 11, 2020 · 0 comments
Open

"odd number of parameters" #32

asicerik opened this issue Sep 11, 2020 · 0 comments

Comments

@asicerik
Copy link

asicerik commented Sep 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant