8 releases

0.4.0 Aug 6, 2024
0.3.4 May 1, 2024
0.3.3 Apr 24, 2024
0.3.2 Jul 29, 2023
0.1.0 Jan 16, 2023

#1151 in Database interfaces

Download history 1/week @ 2025-01-30 7/week @ 2025-02-06 18/week @ 2025-02-13 38/week @ 2025-02-20 16/week @ 2025-02-27 6/week @ 2025-03-13 23/week @ 2025-03-20 26/week @ 2025-03-27 11/week @ 2025-04-03 2/week @ 2025-04-17 39/week @ 2025-04-24 14/week @ 2025-05-01 22/week @ 2025-05-08 28/week @ 2025-05-15

105 downloads per month
Used in 2 crates (via dipper)

MIT/Apache

33KB
730 lines

sea-orm-adapter

Crates.io version

Sea ORM Adapter is the Sea ORM adapter for Casbin-rs. With this library, Casbin can load policy from Sea ORM supported database or save policy to it with fully asynchronous support.

Based on Sea ORM, The current supported databases are:

Example

use casbin::{CoreApi, DefaultModel, Enforcer};
use sea_orm::Database;
use sea_orm_adapter::SeaOrmAdapter;

#[tokio::main]
async fn main() {
    let m = DefaultModel::from_file("examples/rbac_model.conf")
        .await
        .unwrap();

    let db = Database::connect("mysql://root:123456@localhost:3306/casbin")
        .await
        .unwrap();

    let a = SeaOrmAdapter::new(db).await.unwrap();
    let e = Enforcer::new(m, a).await.unwrap();
}

Dependencies

~18–37MB
~540K SLoC