How do I create Conditional upsert with dgo2?

Hi!

I’ve tried to insert @if directive into mutation section, for example

mutationAddUnit = `
            @if(eq(dateAdd,0)) {
                uid(uidValue) <name> "%UNIT%" .
                uid(uidValue) <unit> "%UNIT%" .
                uid(uidValue) <dateAdd>  "%DATEADD%" .
                uid(uidValue) <dgraph.type> "unit" .
            }
    `

But always get syntax error:

rpc error: code = Unknown desc = while lexing @if(eq(dateAdd, 0)) { at line 1 column 0: Invalid input: @ at lexText

or

rpc error: code = Unknown desc = while lexing @if(eq(dateAdd, 0)) { at line 1 column 0: Invalid input: @ at lexText

Found: api.Mutation.Cond

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