Skip to main content

Module relationship

Module relationship 

Source
Expand description

Relationship metadata for SQLModel Rust.

Relationships are defined at compile-time (via derive macros) and represented as static metadata on each Model. This allows higher-level layers (query builder, session/UoW, eager/lazy loaders) to generate correct SQL and load related objects without runtime reflection.

Structs§

Lazy
A lazily-loaded related object that requires explicit load() call.
LinkTableInfo
Information about a link/join table for many-to-many relationships.
Related
A related single object (many-to-one or one-to-one).
RelatedMany
A collection of related objects (one-to-many or many-to-many).
RelationshipInfo
Metadata about a relationship between models.

Enums§

LazyLoadStrategy
Lazy loading strategy for relationships.
PassiveDeletes
Passive delete behavior for relationships.
RelationshipKind
The type of relationship between two models.

Traits§

LazyLoader
Minimal session interface needed to load lazy relationships.

Functions§

find_back_relationship
Find the back-relationship from a target model back to the source.
find_relationship
Find a relationship by field name in a model’s RELATIONSHIPS.
validate_back_populates
Validate that back_populates is symmetric between two models.