diesel-adapter

Crates.io Docs CI codecov

Diesel Adapter is the Diesel adapter for Casbin-rs. With this library, Casbin can load policy from Diesel supported database or save policy to it.

Based on Diesel, The current supported databases are:

Install

Add it to Cargo.toml

diesel-adapter = { version = "0.8.1", features = ["postgres"] } async-std = "1.6.4"

Example

```rust use dieseladapter::casbin::prelude::*; use dieseladapter::DieselAdapter;

[async_std::main]

async fn main() -> Result<()> { let mut m = DefaultModel::fromfile("examples/rbacmodel.conf").await?; let a = DieselAdapter::new("postgres://casbinrs:casbinrs@127.0.0.1:5432/casbin", 8)?; let mut e = Enforcer::new(m, a).await?; Ok(()) } ```

Features

Attention: postgres, mysql, sqlite are mutual exclusive which means that you can only activate one of them.