Debian Codegraph @

src/any/mod.rs

raw symbols SCIP
1 //! **SEE DOCUMENTATION BEFORE USE**. Runtime-generic database driver.
2 #![doc = include_str!("install_drivers_note.md")]
3
4 use std::sync::Once;
5
6 pub use sqlx_core::any::driver::install_drivers;
7
8 pub use sqlx_core::any::{
9 Any, AnyArguments, AnyConnectOptions, AnyExecutor, AnyPoolOptions, AnyQueryResult, AnyRow,
10 AnyStatement, AnyTransactionManager, AnyTypeInfo, AnyTypeInfoKind, AnyValue, AnyValueRef,
11 };
12
13 #[allow(deprecated)]
14 pub use sqlx_core::any::AnyKind;
15
16 pub(crate) mod reexports {
17 /// **SEE DOCUMENTATION BEFORE USE**. Type alias for `Pool<Any>`.
18 #[doc = include_str!("install_drivers_note.md")]
19 pub use sqlx_core::any::AnyPool;
20
21 /// **SEE DOCUMENTATION BEFORE USE**. Runtime-generic database connection.
22 #[doc = include_str!("install_drivers_note.md")]
23 pub use sqlx_core::any::AnyConnection;
24 }
25
26 /// Install all currently compiled-in drivers for [`AnyConnection`] to use.
27 ///
28 /// May be called multiple times; only the first call will install drivers, subsequent calls
29 /// will have no effect.
30 ///
31 /// ### Panics
32 /// If [`install_drivers`] has already been called *not* through this function.
33 ///
34 /// [`AnyConnection`]: sqlx_core::any::AnyConnection
35 pub fn install_default_drivers() {
36 static ONCE: Once = Once::new();
37
38 ONCE.call_once(|| {
39 install_drivers(&[
40 #[cfg(feature = "mysql")]
41 sqlx_mysql::any::DRIVER,
42 #[cfg(feature = "postgres")]
43 sqlx_postgres::any::DRIVER,
44 #[cfg(feature = "_sqlite")]
45 sqlx_sqlite::any::DRIVER,
46 ])
47 .expect("non-default drivers already installed")
48 });
49 }