def resolve_book(graph, query): return [ query.element_query.create_object( iterables.to_dict( (field_query.key, resolve_field(graph, book, field_query)) for field_query in query.element_query.fields)) for book in books ]
def resolve_root(graph, query): values = dict( one=1, two=2, ) return query.create_object( iterables.to_dict((field_query.key, values[field_query.field.name]) for field_query in query.fields))
def resolve_book(graph, query): books = [ dict(title="Leave it to Psmith"), dict(title="Pericles, Prince of Tyre"), ] return [ query.element_query.create_object( iterables.to_dict( (field_query.key, book[field_query.field.name]) for field_query in query.element_query.fields)) for book in books ]
def resolve_root(graph, query): return query.create_object( iterables.to_dict( (field_query.key, graph.resolve(field_query.type_query)) for field_query in query.fields))
def resolve_author(graph, query): author = authors[query.author_id] return query.type_query.create_object( iterables.to_dict((field_query.key, author[field_query.field.name]) for field_query in query.type_query.fields))