-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Labels
Stalearea/querylang/varsIssues related to queries with GraphQL variablesIssues related to queries with GraphQL variableskind/featureSomething completely new we should consider.Something completely new we should consider.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.
Description
Given I have a node:
<_:1> <type:emailAccount> "" .
<_:1> <name> "test@example.com" .
I want to be able to retrieve the uid given the name and has(<type:emailAccount>).
I am trying to build the query using QueryWithVars and the golang api.
The query works with a hardcoded $type variable.
variables := map[string]string{
"$name": Name,
// "$type": Type,
}
q := `
query uid($name: string)
{
uid(func:eq(name, $name)) @filter(has(<type:emailAccount>)) {
uid
}
}
`
resp, err := txn.QueryWithVars(ctx, q, variables)
if err != nil {
return "", err
}If i try to use $type as variable, returns the error: rpc error: code = Unknown desc = Got empty attr for function: [has].
q := `
query uid($name: string)
{
uid(func:eq(name, $name)) @filter(has($type)) {
uid
}
}
`
What should be the query in order to work using $type to call has($type)?
Thanks
rafaelcaricio, F21 and amaster507
Metadata
Metadata
Assignees
Labels
Stalearea/querylang/varsIssues related to queries with GraphQL variablesIssues related to queries with GraphQL variableskind/featureSomething completely new we should consider.Something completely new we should consider.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.