Connection
A connection to a list of items.
Attributes: page_info: Pagination data for this connection edges: Contains the nodes in this connection
Methods:
-
resolve_node
The identity function for the node.
This method is used to resolve a node of a different type to the connection’s
NodeType
.By default it returns the node itself, but subclasses can override this to provide a custom implementation.
Signature:
Parameters:
-
node:
The resolved node which should return an instance of this connection’s
NodeType
.- Type
-
Any
-
info:
The strawberry execution info resolve the type name from.
- Type
-
Info
-
kwargs:
- Type
-
Any
- Default
-
{}
-
-
resolve_connection
Resolve a connection from nodes.
Subclasses must define this method to paginate nodes based on
first
/last
/before
/after
arguments.Returns:
The resolved
Connection
Signature:
Parameters:
-
nodes:
An iterable/iteretor of nodes to paginate.
- Type
-
NodeIterableType[NodeType]
-
info:
The strawberry execution info resolve the type name from.
- Type
-
Info
-
before:
Returns the items in the list that come before the specified cursor.
- Type
-
str | None
- Default
-
None
-
after:
Returns the items in the list that come after the specified cursor.
- Type
-
str | None
- Default
-
None
-
first:
Returns the first n items from the list.
- Type
-
int | None
- Default
-
None
-
last:
Returns the items in the list that come after the specified cursor.
- Type
-
int | None
- Default
-
None
-
kwargs:
Additional arguments passed to the resolver.
- Type
-
Any
- Default
-
{}
-
Attributes:
-
page_info:
- Type
-
PageInfo
-
edges:
- Type
-
List[Edge[NodeType]]