1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00

update mysql dependency to 23

This commit is contained in:
Rob Ede 2022-12-11 15:25:15 +00:00
parent 7caab85d01
commit 3ffb06abb7
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
4 changed files with 614 additions and 356 deletions

956
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -63,3 +63,7 @@ members = [
"websockets/echo",
]
resolver = "2"
[patch.crates-io.r2d2_mysql]
git = "https://github.com/outersky/r2d2-mysql.git"
rev = "v23.0.0"

View File

@ -10,9 +10,9 @@ actix-cors = "0.6"
juniper = "0.15"
mysql = "22"
mysql = "23"
r2d2 = "0.8"
r2d2_mysql = "22"
r2d2_mysql = "23"
dotenv = "0.15"
env_logger = "0.9"

View File

@ -1,14 +1,14 @@
use r2d2_mysql::{
mysql::{Opts, OptsBuilder},
MysqlConnectionManager,
MySqlConnectionManager,
};
pub type Pool = r2d2::Pool<MysqlConnectionManager>;
pub type Pool = r2d2::Pool<MySqlConnectionManager>;
pub fn get_db_pool() -> Pool {
let db_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let opts = Opts::from_url(&db_url).unwrap();
let builder = OptsBuilder::from_opts(opts);
let manager = MysqlConnectionManager::new(builder);
let manager = MySqlConnectionManager::new(builder);
r2d2::Pool::new(manager).expect("Failed to create DB Pool")
}