Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roy-ganz/toql_mysql_async
https://github.com/roy-ganz/toql_mysql_async
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/roy-ganz/toql_mysql_async
- Owner: roy-ganz
- Created: 2021-07-20T06:56:02.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-14T16:18:21.000Z (almost 2 years ago)
- Last Synced: 2024-09-10T14:09:21.830Z (2 months ago)
- Language: Rust
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# MySQL Async support for Toql
Add this to your `Cargo.toml`:
```toml
[dependencies]
toql = {version = "0.4", features = ["serde"]}
toql_mysql_async = "0.4"
```And get your Toql with
```rust
use toql_mysql_async::{prelude::MySqlAsync, mysql_async::Pool};
use toql::prelude::Cache;let database_url = "mysql://USER:PASS@localhost:3306/DATABASE";
let pool = Pool::new(database_url);
let mut conn = pool.get_conn().await?;
let cache = Cache::new();
let mut toql = MySqlAsync::from(conn, &cache);
```A transaction can be started from a connection:
```rust
use toql_mysql_async::mysql_async::TxOpts;// let conn = ...
// let cache = ...let tx_opts = TxOpts::default();
let tx = conn.start_transaction(tx_opts).await?;
let mut toql = MySqlAsync::from(tx, &cache);
```## License
Toql MySqlAsync is distributed under the terms of both the MIT license and the
Apache License (Version 2.0).