-
Notifications
You must be signed in to change notification settings - Fork 85
Add example for conditional upsert in README #95
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ A review job has been created and sent to the PullRequest network.
@ashish-goswami you can click here to see the review status or cancel the code review job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment.
| Mutations: []*api.Mutation{mu}, | ||
| CommitNow:true, | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely good on your part to have added this documentation that was missing in dgo. It would be appreciated if the example can be annotated with some inline comments and a quick explanation before diving into it.
Reviewed with ❤️ by PullRequest
| The mutation is executed only when the specified condition is true. If the condition is false, | ||
| the mutation is silently ignored. | ||
|
|
||
| See more about Conditional Upsert [Here](https://docs.dgraph.io/mutations/#conditional-upsert). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend moving this to after the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I followed same thing as Upsert.
|
|
||
| See more about Conditional Upsert [Here](https://docs.dgraph.io/mutations/#conditional-upsert). | ||
|
|
||
| ```go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the style of the rest of dgo's readme, it seems you'd want to mention here that this is an example, or provide some context into what your code is doing. Potentially add comments in line above the Cond:@if(eq(len(user), 1)) line saying that that line is the conditional upsert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment for Cond in mutation.
This change is