Skip to content

Commit

Permalink
Remove Unnecessary Feature Guards
Browse files Browse the repository at this point in the history
  • Loading branch information
anshap1719 committed May 1, 2024
1 parent f8f35dd commit cdf9c96
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/database/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
use std::borrow::Cow;
use std::time::Duration;

mod connection;
mod db_connection;
#[cfg(feature = "mock")]
#[cfg_attr(docsrs, doc(cfg(feature = "mock")))]
mod mock;
#[cfg(feature = "proxy")]
#[cfg_attr(docsrs, doc(cfg(feature = "proxy")))]
mod proxy;
mod statement;
mod stream;
mod transaction;
use tracing::instrument;

pub use connection::*;
pub use db_connection::*;
Expand All @@ -21,13 +12,23 @@ pub use mock::*;
#[cfg_attr(docsrs, doc(cfg(feature = "proxy")))]
pub use proxy::*;
pub use statement::*;
use std::borrow::Cow;
pub use stream::*;
use tracing::instrument;
pub use transaction::*;

use crate::error::*;

mod connection;
mod db_connection;
#[cfg(feature = "mock")]
#[cfg_attr(docsrs, doc(cfg(feature = "mock")))]
mod mock;
#[cfg(feature = "proxy")]
#[cfg_attr(docsrs, doc(cfg(feature = "proxy")))]
mod proxy;
mod statement;
mod stream;
mod transaction;

/// Defines a database
#[derive(Debug, Default)]
pub struct Database;
Expand Down Expand Up @@ -63,7 +64,6 @@ pub struct ConnectOptions {
/// Schema search path (PostgreSQL only)
pub(crate) schema_search_path: Option<String>,
pub(crate) test_before_acquire: bool,
#[cfg(feature = "sqlx-postgres")]
pub(crate) application_name: Option<&'static str>,
}

Expand Down Expand Up @@ -159,7 +159,6 @@ impl ConnectOptions {
sqlcipher_key: None,
schema_search_path: None,
test_before_acquire: true,
#[cfg(feature = "sqlx-postgres")]
application_name: None,
}
}
Expand Down Expand Up @@ -303,14 +302,12 @@ impl ConnectOptions {
}

/// Set the application name for the connection (PostgreSQL only)
#[cfg(feature = "sqlx-postgres")]
pub fn application_name(&mut self, value: &'static str) -> &mut Self {
self.application_name = Some(value);
self
}

/// Get the application name for the connection (PostgreSQL only)
#[cfg(feature = "sqlx-postgres")]
pub fn get_application_name(&self) -> Option<&'static str> {
self.application_name
}
Expand Down

0 comments on commit cdf9c96

Please sign in to comment.