Go Client Mutations

This is with reference to the issue https://github.com/dgraph-io/dgraphgoclient/issues/5

Now that I understand better how the lexing/parsing is done, I have more idea about this.

  • When q is a raw string literal with \n
    q := `mutation { set {<alice> <follows> <bob> . \n <alice> <name> "Alice" . \n <bob> <name> "Bob" . }}`

doesn’t work because if q is a raw string literal \n isn’t interpreted, so only the first mutation is applied.

  • When q is a raw string literal with explicit new line.
q := `mutation { set {<alice> <follows> <bob> . 
   <alice> <name> "Alice" . 
   <bob> <name> "Bob" . }}`

This would work when we give new lines explicitly.

  • When q is an interpreted string literal with \n
    q := "mutation { set {<alice> <follows> <bob> . \n <alice> <name> \"Alice\" . \n <bob> <name> \"Bob\" . }}"

Works but object values have to be escaped as " has to be escaped.

So there isn’t a bug here actually. Am I missing something here @mrjn?

Not a bug. But, our client should allow easier way to create a batch of mutations. Also, we can avoid having to send out mutations in the string format.

1 Like

Makes sense. We should definitely have an interface which makes it easier for the user to send multiple mutations, so that they doesn’t have to worry about this stuff.

Added a task here https://app.asana.com/0/110655897041990/160722178820207

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.