Hi,
I’m totally new to Elixir, Phoenix, and Absinthe…so go easy on me.
I’m experimenting with a graph database called Dgraph using a library called Dlex. I’ve written a simple query designed to look up and return a list of users (I only have two users at the moment):
def list_users() do
query = """
{
users(func: type(User)) {
uid
email
name
}
}
"""
{:ok, %{"users" => result}} = Dlex.query(:dlex, query)
IO.inspect(result)
{:ok, result}
end
The output from IO.inspect(result)
is precisely what I expect and want—a list of my two users:
[
%{"email" => "rob@example.com", "name" => "Rob", "uid" => "0x1"},
%{"email" => "bridget@example.com", "name" => "Bridget", "uid" => "0x2"}
]
However, when I run this query with GraphiQL, all the values in the result are null
for some reason:
{
"data": {
"users": [
{
"email": null,
"name": null,
"uid": null
},
{
"email": null,
"name": null,
"uid": null
}
]
}
}
Any idea what I’m doing wrong?