Beispiel #1
0
 def fields():
     books = many(
         book_join_type,
         lambda *_: all_books,
         join={"id": "authorId"},
     )
     return {
         "id": field(attr="id", type=GraphQLInt),
         "name": field(attr="name", type=GraphQLString),
         "books": books,
         "bookTitles": extract(books, "title"),
     }
Beispiel #2
0
    def fields():
        books = many(
            book_join_type,
            book_query,
            join={"id": "authorId"},
        )

        return {
            "id": field(column_name="id", type=GraphQLInt),
            "name": field(column_name="name", type=GraphQLString),
            "books": books,
            "bookTitles": extract(books, "title"),
        }
Beispiel #3
0
    def fields():
        author = single(
            author_join_type,
            lambda *_: all_authors,
            join={"authorId": "id"},
        )

        return {
            "id": field(attr="id", type=GraphQLInt),
            "title": field(attr="title", type=GraphQLString),
            "authorId": field(attr="author_id", type=GraphQLInt),
            "author": author,
            "booksBySameAuthor": extract(author, "books"),
        }
Beispiel #4
0
    def fields():
        author = single(
            author_join_type,
            author_query,
            join={"authorId": "id"},
        )

        return {
            "id": field(column_name="id", type=GraphQLInt),
            "title": field(column_name="title", type=GraphQLString),
            "authorId": field(column_name="author_id", type=GraphQLInt),
            "author": author,
            "booksBySameAuthor": extract(author, "books"),
        }
Beispiel #5
0
    def instantiate(self):
        if self._relationship._owner is None:
            self._relationship._owner = self._owner

        return graphjoiner.extract(self._relationship.field(),
                                   self._field_name)