Skip to content

Conversation

@tvolk131
Copy link

@tvolk131 tvolk131 commented May 6, 2025

Enhancements

  • DatabaseConnection is now always Clone, even when the mock feature is activated

AFAIK this should be safe since the MySQL, Postgres, and SQLite variants all implement Clone already, and the mock and proxy variants are wrapped in Arcs

Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, makes sense. I've edited your PR description to add a changelog.

@tyt2y3, you can merge this.

I'm going to enhance these DatabaseConnection docs afterwards

@Huliiiiii
Copy link
Member

Hi, could you please resolve the conflicts?

@tvolk131
Copy link
Author

Hi, could you please resolve the conflicts?

Ahh thanks for the reminder! I'll get on this later tonight.

@Huliiiiii
Copy link
Member

Huliiiiii commented Sep 18, 2025

No longer needed since this restriction was removed in 2.0. (That's why there are conflicts 😂.)

Anyway, thank you for your contribution!

/// Handle a database connection depending on the backend enabled by the feature
/// flags. This creates a connection pool internally (for SQLx connections),
/// and so is cheap to clone.
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct DatabaseConnection {
/// `DatabaseConnection` used to be a enum. Now it's moved into inner,
/// because we have to attach other contexts.
pub inner: DatabaseConnectionType,
#[cfg(feature = "rbac")]
pub(crate) rbac: crate::RbacEngineMount,
}

@Huliiiiii Huliiiiii closed this Sep 18, 2025
@tvolk131 tvolk131 deleted the db_conn_always_clone branch September 18, 2025 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants