Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/test-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ commit() {
# --- fixture repository ----------------------------------------------------
mkdir repo && cd repo
git init -q
printf '[package]\nname = "sqlx-adapter"\nversion = "0.0.0"\nedition = "2018"\n' >Cargo.toml
printf '[package]\nname = "casbin-sqlx-adapter"\nversion = "0.0.0"\nedition = "2018"\n' >Cargo.toml
echo 'fixture' >LICENSE
git add . && commit 'fixture'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ jobs:
NOTES="$RUNNER_TEMP/notes.md"
if [ "$IS_RC" = true ]; then
cat >"$NOTES" <<EOF
Release candidate for sqlx-adapter $VERSION. **This is not an Apache release**; it is the source tarball for the Apache vote.
Release candidate for Apache Casbin SQLx Adapter (Incubating) $VERSION. **This is not an Apache release**; it is the source tarball for the Apache vote.

Release manager: download \`$BASENAME.tar.gz\` and its \`.sha512\`, sign the tarball with your key from the Casbin KEYS file, stage all three files under \`dist/dev/incubator/casbin/\`, and start the vote. See RELEASING.md.
EOF
else
cat >"$NOTES" <<EOF
sqlx-adapter $VERSION.
Apache Casbin SQLx Adapter (Incubating) $VERSION (crate: casbin-sqlx-adapter).

The attached files are the voted source release, byte for byte as published at https://downloads.apache.org/incubator/casbin/sqlx-adapter-$VERSION-incubating/ (verify with https://www.apache.org/info/verification.html). The crate on crates.io is built from these sources.
EOF
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

[package]
name = "sqlx-adapter"
name = "casbin-sqlx-adapter"
# Placeholder on purpose. The release workflow derives the real version from
# the git tag (vX.Y.Z -> X.Y.Z) and substitutes it when it builds the source
# archive and publishes the crate, so nothing in the tree has to be bumped.
Expand All @@ -36,6 +36,10 @@ readme = "README.md"
# when packaging from an extracted source archive where .gitignore does not apply.
exclude = ["*.db", "*.db-wal", "*.db-shm"]

[lib]
# Preserve existing Rust imports when changing the registry package name.
name = "sqlx_adapter"

[dependencies]
casbin = { version = "2.1.0", default-features = false }
sqlx = { version = "0.9", default-features = false, features = ["macros"] }
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ specific language governing permissions and limitations
under the License.
-->

# sqlx-adapter
# Apache Casbin SQLx Adapter (Incubating)

Apache Casbin (Incubating) is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

[![Crates.io](https://img.shields.io/crates/v/sqlx-adapter.svg)](https://crates.io/crates/sqlx-adapter)
[![Docs](https://docs.rs/sqlx-adapter/badge.svg)](https://docs.rs/sqlx-adapter)
[![Crates.io](https://img.shields.io/crates/v/casbin-sqlx-adapter.svg)](https://crates.io/crates/casbin-sqlx-adapter)
[![Docs](https://docs.rs/casbin-sqlx-adapter/badge.svg)](https://docs.rs/casbin-sqlx-adapter)
[![CI](https://github.com/apache/casbin-sqlx-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/apache/casbin-sqlx-adapter/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/apache/casbin-sqlx-adapter/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/casbin-sqlx-adapter)

sqlx-adapter is the [Sqlx](https://github.com/launchbadge/sqlx) adapter for [casbin-rs](https://github.com/apache/casbin-rs). With this library, Casbin can load policy from Sqlx supported database or save policy to it with fully asynchronous support.
casbin-sqlx-adapter is the [SQLx](https://github.com/launchbadge/sqlx) adapter for [casbin-rs](https://github.com/apache/casbin-rs). With this library, Casbin can load policy from a SQLx-supported database or save policy to it with fully asynchronous support.

Based on [Sqlx](https://github.com/launchbadge/sqlx), The current supported databases are:
Based on [SQLx](https://github.com/launchbadge/sqlx), the current supported databases are:

- [MySQL](https://www.mysql.com/)
- [PostgreSQL](https://github.com/lib/pq)
Expand All @@ -54,24 +54,32 @@ Add the following to `Cargo.toml`:
For MySQL:

```toml
sqlx-adapter = { version = "1", default-features = false, features = ["mysql", "runtime-tokio", "tls-native-tls"]}
casbin-sqlx-adapter = { version = "1.9", default-features = false, features = ["mysql", "runtime-tokio", "tls-native-tls"]}
tokio = { version = "1.1.1", features = ["macros"] }
```

For PostgreSQL:

```toml
sqlx-adapter = { version = "1", default-features = false, features = ["postgres", "runtime-tokio", "tls-native-tls"]}
casbin-sqlx-adapter = { version = "1.9", default-features = false, features = ["postgres", "runtime-tokio", "tls-native-tls"]}
tokio = { version = "1.1.1", features = ["macros"] }
```

For SQLite:

```toml
sqlx-adapter = { version = "1", default-features = false, features = ["sqlite", "runtime-tokio", "tls-native-tls"]}
casbin-sqlx-adapter = { version = "1.9", default-features = false, features = ["sqlite", "runtime-tokio", "tls-native-tls"]}
tokio = { version = "1.1.1", features = ["macros"] }
```

Starting with 1.9.0, the registry package name changes from `sqlx-adapter` to
`casbin-sqlx-adapter`. Replace the dependency key in Cargo.toml as shown above.
The library name remains `sqlx_adapter`, so existing Rust imports and the
`SqlxAdapter` type do not change. Existing versions of `sqlx-adapter` remain
available. Release candidates are for review and are not published to crates.io;
the new package and documentation links become available after release approval
and publication.

**Warning**: `tokio v1.0` or later is supported from `sqlx-adapter v0.4.0`, we recommend that you upgrade the relevant components to ensure that they work properly. The last version that supports `tokio v0.2` is `sqlx-adapter v0.3.0` , you can choose according to your needs.

## Configure
Expand Down
8 changes: 8 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ built from exactly those bytes.

## 1. Release candidate

Starting with 1.9.0, the crate is named `casbin-sqlx-adapter`; the library target
remains `sqlx_adapter` to preserve Rust imports. Confirm the package name with
the project and ensure its crates.io publishing account can administer the new
crate. An unused name is not a reservation or proof of project control. Check
the packaged manifest, README installation examples and docs.rs links together.
Do not publish an unapproved candidate merely to reserve the name. The ASF
source archive prefix and distribution directory naming remain unchanged.

Pick the commit to release (CI green on `master`) and push an RC tag:

```bash
Expand Down
Loading