Skip to content

Commit

Permalink
Merge pull request #36 from outersky/mysql24
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede authored Jul 8, 2023
2 parents 5827ac3 + 0c83111 commit 15db0f3
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 33 deletions.
1 change: 0 additions & 1 deletion .clippy.toml

This file was deleted.

16 changes: 4 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,18 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [1.59.0, stable, nightly]
version: [1.65.0, stable, nightly]

name: tests / ${{ matrix.version }}
runs-on: ubuntu-latest

env:
CI: 1
CARGO_UNSTABLE_SPARSE_REGISTRY: true

steps:
- uses: actions/checkout@v3

- name: Install Rust
run: |
rustup install ${{ matrix.version }} --no-self-update --profile minimal --force
rustup override set ${{ matrix.version }}
- run: cargo generate-lockfile
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2.2.0
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
with:
toolchain: ${{ matrix.version }}

- name: Setup MySQL
uses: mirromutth/mysql-action@v1.1
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

## Unreleased

## 24.0.0

- Update `mysql` dependency to `24`.
- Remove deprecated `MysqlConnectionManager` type alias.
- Minimum supported Rust version (MSRV) is now 1.65 due to transitive dependencies.

## 23.0.0

- Update `mysql` dependency to `23`.
- Rename `MysqlConnectionManager` to `MySqlConnectionManager`. The old name remains available under a deprecated type alias.
- Hide `pool` module.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[package]
name = "r2d2_mysql"
version = "23.0.0"
version = "24.0.0"
authors = ["outersky <outersky@gmail.com>"]
license = "MIT"
description = "MySQL support for the r2d2 connection pool"
repository = "https://github.com/outersky/r2d2-mysql.git"
keywords = ["mysql", "sql", "pool", "database", "r2d2"]
edition = "2018"
edition = "2021"
rust-version = "1.65"

[dependencies]
r2d2 = "0.8.9"
mysql = "23"
mysql = "24"
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
# r2d2-mysql
# r2d2_mysql

> [`mysql`](https://github.com/blackbeam/rust-mysql-simple) support library for the [`r2d2`](https://github.com/sfackler/r2d2) connection pool.
[![crates.io](https://img.shields.io/crates/v/r2d2-mysql?label=latest)](https://crates.io/crates/r2d2-mysql)
[![Documentation](https://docs.rs/r2d2-mysql/badge.svg?version=23)](https://docs.rs/r2d2-mysql/23)
[![crates.io](https://img.shields.io/crates/v/r2d2_mysql?label=latest)](https://crates.io/crates/r2d2_mysql)
[![Documentation](https://docs.rs/r2d2_mysql/badge.svg?version=24)](https://docs.rs/r2d2_mysql/24)
![Version](https://img.shields.io/badge/rustc-1.59+-ab6000.svg)
![License](https://img.shields.io/crates/l/r2d2-mysql.svg)
[![Download](https://img.shields.io/crates/d/r2d2-mysql.svg)](https://crates.io/crates/r2d2-mysql)
![License](https://img.shields.io/crates/l/r2d2_mysql.svg)
[![Download](https://img.shields.io/crates/d/r2d2_mysql.svg)](https://crates.io/crates/r2d2_mysql)

## Install

Include `r2d2_mysql` in the `[dependencies]` section of your `Cargo.toml`:

```toml
[dependencies]
r2d2_mysql = "23"
r2d2_mysql = "24"
```

## Usage

```rust
use std::{env, sync::Arc, thread};
use mysql::{prelude::*, Opts, OptsBuilder};
use r2d2_mysql::MySqlConnectionManager;

use r2d2_mysql::{
mysql::{prelude::*, Opts, OptsBuilder},
r2d2, MySqlConnectionManager,
};

fn main() {
let url = env::var("DATABASE_URL").unwrap();
Expand Down
3 changes: 2 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -eEuxo pipefail

DATABASE_NAME="rust_mysql_test"
export DATABASE_URL="mysql://root@localhost:3306/${DATABASE_NAME}"

Expand All @@ -11,4 +13,3 @@ cargo test

# Clean up after ourselves and drop the database
mysql -uroot -e "DROP DATABASE ${DATABASE_NAME}"

9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
//! # Examples
//! ```
//! use std::{env, sync::Arc, thread};
//! use mysql::{prelude::*, Opts, OptsBuilder};
//! use r2d2_mysql::MySqlConnectionManager;
//!
//! use r2d2_mysql::{
//! mysql::{prelude::*, Opts, OptsBuilder},
//! r2d2, MySqlConnectionManager,
//! };
//!
//! let url = env::var("DATABASE_URL").unwrap();
//! let opts = Opts::from_url(&url).unwrap();
Expand Down Expand Up @@ -38,8 +41,6 @@ pub use r2d2;

mod pool;
pub use self::pool::MySqlConnectionManager;
#[allow(deprecated)]
pub use self::pool::MysqlConnectionManager;

#[cfg(test)]
mod test {
Expand Down
4 changes: 0 additions & 4 deletions src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

use mysql::{error::Error, prelude::*, Conn, Opts, OptsBuilder};

#[doc(hidden)]
#[deprecated(since = "23.0.0", note = "Renamed to `MySqlConnectionManager`.")]
pub type MysqlConnectionManager = MySqlConnectionManager;

/// An [`r2d2`] connection manager for [`mysql`] connections.
#[derive(Clone, Debug)]
pub struct MySqlConnectionManager {
Expand Down

0 comments on commit 15db0f3

Please sign in to comment.