-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Labels
kind/featureSomething completely new we should consider.Something completely new we should consider.
Milestone
Description
This operation would allow a user to run a query, and use its results (via variables) to execute the mutation. This would then allow upserts to happen, without doing multiple network calls to the DB.
txn {
query {
me(func: eq(email, "someone@gmail.com")) {
v as uid
}
}
mutation @if(eq(len(v), 0)) {
set {
<uid(v)> <name> "Some One" .
<uid(v)> <email> "someone@gmail.com" .
}
}
}
This txn would check for an account with email=someone@gmail.com, and only if it is present, would
it run the mutation.
This should return the result of query, normally. And also return the result of the mutation.
Additionally, we should be able to optionally do the mutation, iff the email is already present.
txn {
query {
me(func: eq(email, "someone@gmail.com")) {
v as uid
}
}
mutation @if(gt(len(v), 0)) {
set {
<uid(v)> <name> "Changed Name" .
}
}
}
This would introduce a new txn operator, and a new if directive applicable for mutations.
dihmeetree, MichelDiz, liqweed, makitka2007, selmeci and 9 moreMichelDizpaulrostorp
Metadata
Metadata
Assignees
Labels
kind/featureSomething completely new we should consider.Something completely new we should consider.