swell/connection
Types
Connection wrapper containing edges and page info
pub type Connection(node_type) {
Connection(
edges: List(Edge(node_type)),
page_info: PageInfo,
total_count: option.Option(Int),
)
}
Constructors
-
Connection( edges: List(Edge(node_type)), page_info: PageInfo, total_count: option.Option(Int), )
Edge wrapper containing a node and its cursor
pub type Edge(node_type) {
Edge(node: node_type, cursor: String)
}
Constructors
-
Edge(node: node_type, cursor: String)
PageInfo type for connection pagination metadata
pub type PageInfo {
PageInfo(
has_next_page: Bool,
has_previous_page: Bool,
start_cursor: option.Option(String),
end_cursor: option.Option(String),
)
}
Constructors
-
PageInfo( has_next_page: Bool, has_previous_page: Bool, start_cursor: option.Option(String), end_cursor: option.Option(String), )
Values
pub fn backward_pagination_args() -> List(schema.Argument)
Standard pagination arguments for backward pagination
pub fn connection_args() -> List(schema.Argument)
All standard connection arguments (forward + backward) Note: sortBy is not included yet as it requires InputObject type support
pub fn connection_to_value(
connection: Connection(value.Value),
) -> value.Value
Converts a Connection to a GraphQL value
pub fn connection_type(
node_type_name: String,
edge_type: schema.Type,
) -> schema.Type
Creates a Connection type for a given node type name
pub fn edge_to_value(edge: Edge(value.Value)) -> value.Value
Converts an Edge to a GraphQL value
pub fn edge_type(
node_type_name: String,
node_type: schema.Type,
) -> schema.Type
Creates an Edge type for a given node type name
pub fn forward_pagination_args() -> List(schema.Argument)
Standard pagination arguments for forward pagination
pub fn page_info_to_value(page_info: PageInfo) -> value.Value
Converts a PageInfo value to a GraphQL value