Module relations

Module relations 

Source
Expand description

Relation loading support for eager and lazy loading.

This module provides types and operations for loading related data:

  • Include for eager loading relations
  • Select for specifying which fields to return
  • Nested relation specifications

§Example

// Eager load posts with their author
let posts = client
    .post()
    .find_many()
    .include(post::author::fetch())
    .include(post::comments::fetch().take(5))
    .exec()
    .await?;

// Select specific fields
let users = client
    .user()
    .find_many()
    .select(user::select! {
        id,
        email,
        posts: { id, title }
    })
    .exec()
    .await?;

Structs§

Include
Builder for include specifications.
IncludeSpec
Specification for including a relation in a query.
RelationLoader
Relation loader for executing relation queries.
RelationSpec
Specification for a relation between models.
SelectSpec
Specification for which fields to select from a model.

Enums§

FieldSelection
Field selection mode.
RelationLoadStrategy
Strategy for loading relations.
RelationType
Type of relation between models.