Skip to content

chore: upgrade bb8 to v9.0 #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 19, 2024
Merged
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
52 changes: 26 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -14,27 +14,27 @@ rust-version = "1.78.0"

[dependencies]
diesel = { version = "~2.2.0", default-features = false, features = [
"i-implement-a-third-party-backend-and-opt-into-breaking-changes",
"i-implement-a-third-party-backend-and-opt-into-breaking-changes",
] }
async-trait = "0.1.66"
futures-channel = { version = "0.3.17", default-features = false, features = [
"std",
"sink",
"std",
"sink",
], optional = true }
futures-util = { version = "0.3.17", default-features = false, features = [
"std",
"sink",
"std",
"sink",
] }
tokio-postgres = { version = "0.7.10", optional = true }
tokio = { version = "1.26", optional = true }
mysql_async = { version = "0.34", optional = true, default-features = false, features = [
"minimal-rust",
"minimal-rust",
] }
mysql_common = { version = "0.32", optional = true, default-features = false }

bb8 = { version = "0.8", optional = true }
bb8 = { version = "0.9", optional = true }
deadpool = { version = "0.12", optional = true, default-features = false, features = [
"managed",
"managed",
] }
mobc = { version = ">=0.7,<0.10", optional = true }
scoped-futures = { version = "0.1", features = ["std"] }
@@ -50,11 +50,11 @@ assert_matches = "1.0.1"
[features]
default = []
mysql = [
"diesel/mysql_backend",
"mysql_async",
"mysql_common",
"futures-channel",
"tokio",
"diesel/mysql_backend",
"mysql_async",
"mysql_common",
"futures-channel",
"tokio",
]
postgres = ["diesel/postgres_backend", "tokio-postgres", "tokio", "tokio/rt"]
sqlite = ["diesel/sqlite", "sync-connection-wrapper"]
@@ -73,24 +73,24 @@ harness = true

[package.metadata.docs.rs]
features = [
"postgres",
"mysql",
"sqlite",
"deadpool",
"bb8",
"mobc",
"async-connection-wrapper",
"sync-connection-wrapper",
"r2d2",
"postgres",
"mysql",
"sqlite",
"deadpool",
"bb8",
"mobc",
"async-connection-wrapper",
"sync-connection-wrapper",
"r2d2",
]
no-default-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[workspace]
members = [
".",
"examples/postgres/pooled-with-rustls",
"examples/postgres/run-pending-migrations-with-rustls",
"examples/sync-wrapper",
".",
"examples/postgres/pooled-with-rustls",
"examples/postgres/run-pending-migrations-with-rustls",
"examples/sync-wrapper",
]
14 changes: 8 additions & 6 deletions src/async_connection_wrapper.rs
Original file line number Diff line number Diff line change
@@ -194,13 +194,15 @@ mod implementation {
C: crate::AsyncConnection,
B: BlockOn + Send,
{
type Cursor<'conn, 'query> = AsyncCursorWrapper<'conn, C::Stream<'conn, 'query>, B>
where
Self: 'conn;
type Cursor<'conn, 'query>
= AsyncCursorWrapper<'conn, C::Stream<'conn, 'query>, B>
where
Self: 'conn;

type Row<'conn, 'query> = C::Row<'conn, 'query>
where
Self: 'conn;
type Row<'conn, 'query>
= C::Row<'conn, 'query>
where
Self: 'conn;

fn load<'conn, 'query, T>(
&'conn mut self,
6 changes: 5 additions & 1 deletion src/mysql/row.rs
Original file line number Diff line number Diff line change
@@ -37,7 +37,11 @@ impl RowSealed for MysqlRow {}

impl<'a> diesel::row::Row<'a, Mysql> for MysqlRow {
type InnerPartialRow = Self;
type Field<'b> = MysqlField<'b> where Self: 'b, 'a: 'b;
type Field<'b>
= MysqlField<'b>
where
Self: 'b,
'a: 'b;

fn field_count(&self) -> usize {
self.0.columns_ref().len()
6 changes: 5 additions & 1 deletion src/pg/row.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,11 @@ impl RowSealed for PgRow {}

impl<'a> diesel::row::Row<'a, diesel::pg::Pg> for PgRow {
type InnerPartialRow = Self;
type Field<'b> = PgField<'b> where Self: 'b, 'a: 'b;
type Field<'b>
= PgField<'b>
where
Self: 'b,
'a: 'b;

fn field_count(&self) -> usize {
self.row.len()
1 change: 0 additions & 1 deletion src/pooled_connection/bb8.rs
Original file line number Diff line number Diff line change
@@ -65,7 +65,6 @@ pub type PooledConnection<'a, C> = bb8::PooledConnection<'a, AsyncDieselConnecti
/// Type alias for using [`bb8::RunError`] with [`diesel-async`]
pub type RunError = bb8::RunError<super::PoolError>;

#[async_trait::async_trait]
impl<C> ManageConnection for AsyncDieselConnectionManager<C>
where
C: PoolableConnection + 'static,
18 changes: 11 additions & 7 deletions src/run_query_dsl/mod.rs
Original file line number Diff line number Diff line change
@@ -92,17 +92,21 @@ pub mod methods {
DB: QueryMetadata<T::SqlType>,
ST: 'static,
{
type LoadFuture<'conn> = future::MapOk<
type LoadFuture<'conn>
= future::MapOk<
Conn::LoadFuture<'conn, 'query>,
fn(Conn::Stream<'conn, 'query>) -> Self::Stream<'conn>,
> where Conn: 'conn;
>
where
Conn: 'conn;

type Stream<'conn> = stream::Map<
type Stream<'conn>
= stream::Map<
Conn::Stream<'conn, 'query>,
fn(
QueryResult<Conn::Row<'conn, 'query>>,
) -> QueryResult<U>,
>where Conn: 'conn;
fn(QueryResult<Conn::Row<'conn, 'query>>) -> QueryResult<U>,
>
where
Conn: 'conn;

fn internal_load(self, conn: &mut Conn) -> Self::LoadFuture<'_> {
conn.load(self)