class Root(RootType):
    books = many(lambda: select(Book))
    book = single_or_null(lambda: select(Book))

    @book.arg("id", GraphQLInt)
    def book_id(query, book_id):
        return query.filter(BookRecord.c_id == book_id)

    author = single_or_null(lambda: select(Author))

    @author.arg("id", GraphQLInt)
    def author_id(query, author_id):
        return query.filter(AuthorRecord.c_id == author_id)
Example #2
0
 class Root(RootType):
     author = single_or_null(lambda: self._join_to_authors(count=0))
Example #3
0
 class Root(RootType):
     author = single_or_null(lambda: StaticDataObjectType.select(Author))