A type-driven and high performance ORM framework
- Association
- Calculation push-down
- Type driven
// entity.rs
#[derive(Entity)]
pub struct Meeting {
#[id]
pub id: u32,
pub start_time: u64,
pub end_time: u64
}
// main.rs
fn meeting_length(id: u32) -> QueryResult<u64> {
Meeting::all()
.filter(|m| eq!(m.id, id))
.first()
.map(|m| m.end_time - m.start_time)
.exec()
}
Generated query:
SELECT (m.end_time - m.start_time)
FROM meeting m
WHERE m.id = ? LIMIT 1;