Skip to main content

Connection

Type Alias Connection 

Source
pub type Connection<N, V, C = DefaultConnectionName, D = DefaultEdgeName> = Connection<Cursor<V>, N, EmptyFields, EmptyFields, C, D, DisableNodesField>;
Available on crate feature async-graphql only.
Expand description

One page of N, resumed by the engine’s own keyset cursor.

The NODE comes first because it is the half a reader is asking about: Connection<MediaOutput, MediaSqliteCursor> says what a client receives, then how it resumes. async-graphql’s own parameter order is the other way round, and this alias is the one place the two meet.

§The two NAME parameters, and why they are last and defaulted

C and D are the SDL names of the page object and of one edge — async-graphql’s ConnectionNameType and EdgeNameType hooks, which the library resolves by calling type_name::<N>() rather than by any Rust name. They sit LAST and each carries its default, so Connection<N, V> is the same type it was and every call site that writes two parameters is untouched: the knob is a pure widening, which is the law this crate applies to every argument and type parameter it adds.

The DEFAULTS are the Relay Cursor Connections specification’s own vocabulary — <Node>Connection and <Node>Edge — and they are what a HAND-WRITTEN Connection<N, V> still publishes, this alias being a widening that moved nothing.

A DECLARATION’s page does not reach them, and that is not this alias’s decision: the emitted legs close both parameters in every case, on markers the expansion mints, because the user’s ruling of 2026-08-13 put the page’s name on the record’s PLURAL — ReelsConnection, not ReelConnection — and the library’s default renders over the node’s own type name, which is the singular. emit::queries’s own note carries the tower those markers resolve, its three tiers and what leaving the specification’s shape costs a client’s tooling.

Aliased Type§

pub struct Connection<N, V, C = DefaultConnectionName, D = DefaultEdgeName> {
    pub edges: Vec<Edge<Cursor<V>, N, EmptyFields, D>>,
    pub additional_fields: EmptyFields,
    pub has_previous_page: bool,
    pub has_next_page: bool,
    /* private fields */
}

Fields§

§edges: Vec<Edge<Cursor<V>, N, EmptyFields, D>>

All edges of the current page.

§additional_fields: EmptyFields

Additional fields for connection object.

§has_previous_page: bool

If true means has previous page.

§has_next_page: bool

If true means has next page.