Skip to content

Commit

Permalink
feat(quaint): remove "expose-drivers" feature, as asked
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomyno committed Nov 15, 2023
1 parent 95a4e28 commit 2adbcde
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 52 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ napi-derive = "2.12.4"
[workspace.dependencies.quaint]
path = "quaint"
features = [
"expose-drivers",
"fmt-sql",
"mssql",
"mysql",
Expand Down
3 changes: 0 additions & 3 deletions quaint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ features = ["docs", "all"]
[features]
default = ["mysql", "postgresql", "mssql", "sqlite"]
docs = []
# Expose the underlying database drivers when a connector is enabled. This is a
# way to access database-specific methods when you need extra control.
expose-drivers = []

native = [
"postgresql-native",
Expand Down
11 changes: 0 additions & 11 deletions quaint/src/connector/mssql/native/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ use tiberius::*;
use tokio::net::TcpStream;
use tokio_util::compat::{Compat, TokioAsyncWriteCompatExt};

/// The underlying SQL Server driver. Only available with the `expose-drivers` Cargo feature.
#[cfg(feature = "expose-drivers")]
pub use tiberius;

static SQL_SERVER_DEFAULT_ISOLATION: IsolationLevel = IsolationLevel::ReadCommitted;

#[async_trait]
Expand Down Expand Up @@ -100,13 +96,6 @@ impl Mssql {
Ok(this)
}

/// The underlying Tiberius client. Only available with the `expose-drivers` Cargo feature.
/// This is a lower level API when you need to get into database specific features.
#[cfg(feature = "expose-drivers")]
pub fn client(&self) -> &Mutex<Client<Compat<TcpStream>>> {
&self.client
}

async fn perform_io<F, T>(&self, fut: F) -> crate::Result<T>
where
F: Future<Output = std::result::Result<T, tiberius::error::Error>>,
Expand Down
13 changes: 0 additions & 13 deletions quaint/src/connector/mysql/native/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ use std::{
};
use tokio::sync::Mutex;

/// The underlying MySQL driver. Only available with the `expose-drivers`
/// Cargo feature.
#[cfg(feature = "expose-drivers")]
pub use mysql_async;

impl MysqlUrl {
pub(crate) fn cache(&self) -> LruCache<String, my::Statement> {
LruCache::new(self.query_params.statement_cache_size)
Expand Down Expand Up @@ -90,14 +85,6 @@ impl Mysql {
})
}

/// The underlying mysql_async::Conn. Only available with the
/// `expose-drivers` Cargo feature. This is a lower level API when you need
/// to get into database specific features.
#[cfg(feature = "expose-drivers")]
pub fn conn(&self) -> &Mutex<mysql_async::Conn> {
&self.conn
}

async fn perform_io<F, U, T>(&self, op: U) -> crate::Result<T>
where
F: Future<Output = crate::Result<T>>,
Expand Down
13 changes: 0 additions & 13 deletions quaint/src/connector/postgres/native/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ use std::{
};
use tokio_postgres::{config::ChannelBinding, Client, Config, Statement};

/// The underlying postgres driver. Only available with the `expose-drivers`
/// Cargo feature.
#[cfg(feature = "expose-drivers")]
pub use tokio_postgres;

struct PostgresClient(Client);

impl Debug for PostgresClient {
Expand Down Expand Up @@ -246,14 +241,6 @@ impl PostgreSql {
})
}

/// The underlying tokio_postgres::Client. Only available with the
/// `expose-drivers` Cargo feature. This is a lower level API when you need
/// to get into database specific features.
#[cfg(feature = "expose-drivers")]
pub fn client(&self) -> &tokio_postgres::Client {
&self.client.0
}

async fn fetch_cached(&self, sql: &str, params: &[Value<'_>]) -> crate::Result<Statement> {
let mut cache = self.statement_cache.lock().await;
let capacity = cache.capacity();
Expand Down
11 changes: 0 additions & 11 deletions quaint/src/connector/sqlite/native/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ use async_trait::async_trait;
use std::convert::TryFrom;
use tokio::sync::Mutex;

/// The underlying sqlite driver. Only available with the `expose-drivers` Cargo feature.
#[cfg(feature = "expose-drivers")]
pub use rusqlite;

/// A connector interface for the SQLite database
pub struct Sqlite {
pub(crate) client: Mutex<rusqlite::Connection>,
Expand Down Expand Up @@ -60,13 +56,6 @@ impl Sqlite {
client: Mutex::new(client),
})
}

/// The underlying rusqlite::Connection. Only available with the `expose-drivers` Cargo
/// feature. This is a lower level API when you need to get into database specific features.
#[cfg(feature = "expose-drivers")]
pub fn connection(&self) -> &Mutex<rusqlite::Connection> {
&self.client
}
}

impl_default_TransactionCapable!(Sqlite);
Expand Down

0 comments on commit 2adbcde

Please sign in to comment.