Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths โ ran on the pinned version, not inferred.
Database
โ use sea_orm::Database;
Connect to a SQLite database and fetch all users.
use sea_orm::{Database, DbErr, EntityTrait, QueryFilter};
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "users")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}
async fn run() -> Result<(), DbErr> {
let db = Database::connect("sqlite://./test.db?mode=rwc").await?;
let users = Entity::find().all(&db).await?;
for user in users {
println!("User: {}", user.name);
}
Ok(())
}
Upgrade
Version history
1.1.20latest on crates.io
Audit
Dependencies
No dependency data recorded yet.