class Author(StaticDataObjectType): __records__ = [ AuthorRecord("PGW", "PG Wodehouse"), AuthorRecord("JH", "Joseph Heller"), ] id = field(type=String) name = field(type=String)
class Sales(ObjectType): book_title = field(property_name="title", type=GraphQLString) quantity = field(property_name="quantity", type=GraphQLInt) @staticmethod def __fetch_immediates__(selections, values, context): sales = context.api.fetch_sales( titles=[value.book_title for value in values]) return (tuple(sale[selection.field.property_name] for selection in selections) for sale in sales)
class Book(StaticDataObjectType): __records__ = [ BookRecord("PGW", "Leave it to Psmith"), BookRecord("PGW", "The Code of the Woosters"), ] author_id = field(type=String, internal=True) author = single(lambda: StaticDataObjectType.select( Author, join={Book.author_id: Author.id}, )) title = field(type=String)
class Author(StaticDataObjectType): __records__ = [ AuthorRecord("PG Wodehouse"), AuthorRecord("Joseph Heller"), ] name = field(type=GraphQLString)
class Author(ObjectType, DictQuery): __records__ = [ AuthorRecord("PG Wodehouse"), AuthorRecord("Joseph Heller"), ] name = field(type=String) @classmethod def __fetch_immediates__(cls, selections, query, context): records = cls.__records__ if "nameStartsWith" in query: prefix = query["nameStartsWith"] records = list( filter( lambda record: record.name.startswith(prefix), records, )) return [ tuple( getattr(record, selection.field.attr_name) for selection in selections) for record in records ]
class Book(StaticDataObjectType): __records__ = [] title = field(type=String)
class AuthorSelection(InputObjectType): limit = field(type=Int, default=None) name = field(type=String, default=None)
class AuthorSelection(InputObjectType): name = field(type=String)
class BookSelection(InputObjectType): author_selection = field(type=AuthorSelection)
class AuthorSelection(InputObjectType): names = field(type=List(String))
class SelectionInput(InputObjectType): name = field(type=String)
class Author(InterfaceType): name = field(type=String)
class HasName(InterfaceType): name = field(type=String)
class Author(StaticDataObjectType): __interfaces__ = lambda: [HasName] __records__ = [AuthorRecord("PG Wodehouse")] name = field(type=String)
class Author(StaticDataObjectType): name = field(type=String)
class Root(RootType): value_b = field(type=Int) value_a = field(type=Int) value_c = field(type=Int)
class UserInput(InputObjectType): username = field(type=String) email_address = field(type=String)
class Author(StaticDataObjectType): __records__ = [AuthorRecord("PG Wodehouse")] name = field(type=String)
class Book(StaticDataObjectType): __records__ = [BookRecord("Leave it to Psmith")] title = field(type=String)
class Book(InterfaceType): author = field(type=Author)
class Named(object): name = field(type=String)
class Book(InterfaceType): author = field(type=lambda: Author)
class Selection(StaticDataObjectType): __records__ = [] name = field(type=String)
class Author(ObjectType): name = field(type=String) def __fetch_immediates__(cls, selections, query, context): pass
class BookSelection(InputObjectType): author_selections = field(type=List(AuthorSelection))
class BoxFields(object): value = field(type=GraphQLInt)
class AuthorSelection(InputObjectType): name_starts_with = field(type=String)
class Author(StaticDataObjectType): __records__ = [] name = field(type=String)
class Range(InputObjectType): start = field(type=Int) end = field(type=Int)
class GeneratedType(InputObjectType): __name__ = "User" email_address = field(type=String) __fetch_immediates__ = None