{"id":26482623,"url":"https://github.com/casbin-rs/diesel-adapter","last_synced_at":"2025-04-05T08:06:48.360Z","repository":{"id":36924165,"uuid":"203497131","full_name":"casbin-rs/diesel-adapter","owner":"casbin-rs","description":"Diesel adapter for Casbin-RS (Rust)","archived":false,"fork":false,"pushed_at":"2025-02-01T01:43:51.000Z","size":136,"stargazers_count":27,"open_issues_count":0,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T07:07:35.349Z","etag":null,"topics":["abac","access-control","acl","adapter","auth","authentication","authorization","casbin","casbin-adapter","casbin-rs","diesel","diesel-adapter","mysql","orm","permission","postgresql","rbac","rust","sqlite","storage-driver"],"latest_commit_sha":null,"homepage":"https://github.com/casbin/casbin-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casbin-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-21T03:15:18.000Z","updated_at":"2024-12-24T13:37:06.000Z","dependencies_parsed_at":"2023-12-17T09:31:49.405Z","dependency_job_id":"c22c33b8-465b-4724-a355-2b270f385ca9","html_url":"https://github.com/casbin-rs/diesel-adapter","commit_stats":{"total_commits":91,"total_committers":14,"mean_commits":6.5,"dds":0.7142857142857143,"last_synced_commit":"7b0fbbb543f3786f046baa83eb5d121220d20e21"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-rs%2Fdiesel-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-rs%2Fdiesel-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-rs%2Fdiesel-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-rs%2Fdiesel-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casbin-rs","download_url":"https://codeload.github.com/casbin-rs/diesel-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305934,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abac","access-control","acl","adapter","auth","authentication","authorization","casbin","casbin-adapter","casbin-rs","diesel","diesel-adapter","mysql","orm","permission","postgresql","rbac","rust","sqlite","storage-driver"],"created_at":"2025-03-20T04:14:30.828Z","updated_at":"2025-04-05T08:06:48.340Z","avatar_url":"https://github.com/casbin-rs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Diesel Adapter for Casbin-RS (Rust)\n\n[![Crates.io](https://img.shields.io/crates/v/diesel-adapter.svg)](https://crates.io/crates/diesel-adapter)\n[![Docs](https://docs.rs/diesel-adapter/badge.svg)](https://docs.rs/diesel-adapter)\n[![CI](https://github.com/casbin-rs/diesel-adapter/workflows/CI/badge.svg)](https://github.com/casbin-rs/diesel-adapter/actions)\n[![codecov](https://codecov.io/gh/casbin-rs/diesel-adapter/branch/master/graph/badge.svg)](https://codecov.io/gh/casbin-rs/diesel-adapter)\n\nDiesel Adapter is the [Diesel](https://github.com/diesel-rs/diesel) adapter for [Casbin-rs](https://github.com/casbin/casbin-rs). With this library, Casbin can load policy from Diesel supported database or save policy to it.\n\nBased on [Diesel](https://github.com/diesel-rs/diesel), The current supported databases are:\n\n- [MySQL](https://www.mysql.com/)\n- [PostgreSQL](https://github.com/lib/pq)\n- [SQLite](https://www.sqlite.org)\n\n*Attention*: `postgres`, `mysql`, `sqlite` are mutual exclusive which means that you can only activate one of them.\n\n## Notice\n\nIn order to unify the database table name in Casbin ecosystem, we decide to use `casbin_rule` instead of `casbin_rules` from version `0.9.0`. If you are using old version `diesel-adapter` in your production environment, please use following command and update `diesel-adapter` version:\n\n````SQL\n# MySQL \u0026 PostgreSQL \u0026 SQLite\nALTER TABLE casbin_rules RENAME TO casbin_rule;\n````\n\n## Install\n\nAdd it to `Cargo.toml`\n\n```\ndiesel-adapter = { version = \"0.9.0\", features = [\"postgres\"] }\ntokio = { version = \"1.1.1\", features = [\"macros\", \"rt-multi-thread\"] }\n```\n**Warning**: `tokio v1.0` or later is supported from `diesel-adapter v0.9.0`, we recommend that you upgrade the relevant components to ensure that they work properly. The last version that supports `tokio v0.2` is `diesel-adapter v0.8.3` , you can choose according to your needs.\n\n## Configure\n\nConfigure `env`\n\nRename `sample.env` to `.env` and put `DATABASE_URL`, `POOL_SIZE`   inside\n\n```bash\nDATABASE_URL=postgres://casbin_rs:casbin_rs@localhost:5432/casbin\n# DATABASE_URL=mysql://casbin_rs:casbin_rs@localhost:3306/casbin\n# DATABASE_URL=casbin.db\nPOOL_SIZE=8\n```\n\nOr you can export `DATABASE_URL`, `POOL_SIZE`\n\n```bash\nexport DATABASE_URL=postgres://casbin_rs:casbin_rs@localhost:5432/casbin\nexport POOL_SIZE=8\n```\n\n## Example\n\n```rust\nuse diesel_adapter::casbin::prelude::*;\nuse diesel_adapter::DieselAdapter;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c()\u003e {\n    let mut m = DefaultModel::from_file(\"examples/rbac_model.conf\").await?;\n    let a = DieselAdapter::new(\"postgres://casbin_rs:casbin_rs@127.0.0.1:5432/casbin\", 8)?;\n    let mut e = Enforcer::new(m, a).await?;\n    Ok(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin-rs%2Fdiesel-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasbin-rs%2Fdiesel-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin-rs%2Fdiesel-adapter/lists"}