Compile-time support for external drivers (#3889)

* Make sqlx-macros-core::database public

* Move driver installation to bins

* Fix lint
This commit is contained in:
Bogdan Mircea 2025-07-02 13:48:08 +03:00 committed by GitHub
parent a0e40540e3
commit ba23fdeb76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,8 @@ enum Cli {
async fn main() {
sqlx_cli::maybe_apply_dotenv();
sqlx::any::install_default_drivers();
let Cli::Sqlx(opt) = Cli::parse();
if let Err(error) = sqlx_cli::run(opt).await {

View File

@ -7,6 +7,8 @@ async fn main() {
// Checks for `--no-dotenv` before parsing.
sqlx_cli::maybe_apply_dotenv();
sqlx::any::install_default_drivers();
let opt = Opt::parse();
// no special handling here

View File

@ -204,8 +204,6 @@ where
F: FnMut(&'a str) -> Fut,
Fut: Future<Output = sqlx::Result<T>> + 'a,
{
sqlx::any::install_default_drivers();
let db_url = opts.expect_db_url()?;
backoff::future::retry(

View File

@ -33,6 +33,7 @@ pub struct CachingDescribeBlocking<DB: DatabaseExt> {
#[allow(dead_code)]
impl<DB: DatabaseExt> CachingDescribeBlocking<DB> {
#[allow(clippy::new_without_default, reason = "internal API")]
pub const fn new() -> Self {
CachingDescribeBlocking {
connections: LazyLock::new(|| Mutex::new(HashMap::new())),

View File

@ -27,7 +27,7 @@ pub type Error = Box<dyn std::error::Error>;
pub type Result<T> = std::result::Result<T, Error>;
mod common;
mod database;
pub mod database;
#[cfg(feature = "derive")]
pub mod derives;