Unrecognized character within query

The query:

query Me($id: string){ me(func: eq(k,$id) { uid k l1 l2 l3 { uid } l4 { uid } } }

variables := make(map[string]string)
variables["$id"] = k

txn2 := client.NewTxn()
defer txn2.Discard(ctx)

resp7, err := txn2.QueryWithVars(ctx, q, variables)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp7)

gives me the following: code = Unknown desc = while lexing query Me($id: string){

Unrecognized character inside a func: U+007B ‘{’

AFAIK, ‘{’ is valid syntax, what am I missing?

you have a missing parenthesis right after eq(k, $id) which causes the next { character to be misinterpreted.

I realised a little too late how stupid my question was :smiley:

There are no stupid questions. :wink: We all make mistakes and this is a good example for us all to learn from.

1 Like