Expand description
§Rust Entity Framework (rust-ef)
An EFCore-inspired ORM for Rust, bringing the familiar DbContext/DbSet/EntityType patterns to the Rust ecosystem.
§Example
ⓘ
use rust_ef::prelude::*;
#[derive(EntityType)]
#[table("blogs")]
pub struct Blog {
#[primary_key]
#[auto_increment]
pub blog_id: i32,
#[required]
#[max_length(200)]
pub url: String,
pub rating: i32,
#[navigation]
pub posts: HasMany<Post>,
}Re-exports§
pub use async_trait;pub use inventory;
Modules§
- cascade
- Cascade save: drain children from principal HasMany navigations, FK fixup after principal PK backfill, and M2M join-row insertion via direct SQL.
- change_
executor - Change executor — generates and executes SQL for entity state changes.
- db_
context - DbContext, DbContextOptions, and ChangeTracker — the session / unit-of-work layer.
- db_set
- DbSet
�?entry point for querying and manipulating entity collections. - dependency_
graph - Dependency graph and topological sort — determines entity save order.
- di
- DI integration —
AddDbContextonrust-dix. - entity
- Entity type trait and state definitions.
- error
- Error types for Rust Entity Framework (rust-ef).
- interceptor
- SaveChanges interceptor �?hooks into the DbContext lifecycle.
- lazy
- Lazy loading infrastructure for navigation properties.
- metadata
- Model metadata types for describing entities, properties, and relationships.
- migration
- Migration engine ?model snapshot diffing, migration generation, and history tracking.
- model_
builder - Model builder - ?Fluent API for configuring entity types.
- navigation_
loader - Eager-loading of navigation properties via secondary queries.
- observability
- Tracing/observability instrumentation guards.
- prelude
- Re-exports of the most commonly used types.
- provider
- Database provider abstraction trait.
- query
- Query builder & LINQ-style chainable query API.
- registration
- Compile-time entity registration via
inventory. - relations
- Relationship types (
BelongsTo<T>,HasMany<T>,HasOne<T>). - tracking
- Change tracking �?entity state management, snapshots, and detection.
- transaction
- Transaction handle abstraction.
Macros§
Attribute Macros§
- entity
- Attribute macro for
impl IEntityTypeConfiguration<T>blocks.