Expand description
§Rust Entity Framework (lref)
An EFCore-inspired ORM for Rust, bringing the familiar DbContext/DbSet/EntityType patterns to the Rust ecosystem.
§Example
ⓘ
use lref::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>,
}Modules§
- cache
- Query cache / Identity Map — entity-level caching by primary key.
- change_
executor - Change executor — generates and executes SQL for entity state changes.
- db_
context - DbContext trait, DbContextOptions, and ChangeTracker — the session / unit-of-work layer.
- db_set
- DbSet
— entry point for querying and manipulating entity collections. - di
- DI integration —
AddDbContext<T>onlrdi, interface-oriented. - entity
- Entity type trait and state definitions.
- error
- Error types for Rust Entity Framework.
- interceptor
- SaveChanges interceptor — hooks into the DbContext lifecycle.
- 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.
- prelude
- Re-exports of the most commonly used types.
- provider
- Database provider abstraction trait.
- query
- Query builder — LINQ-style chainable query API.
- relations
- Relationship types (
BelongsTo<T>,HasMany<T>,HasOne<T>). - tracking
- Change tracking — entity state management, snapshots, and detection.