Trait sqlx::ConnectOptions
source · pub trait ConnectOptions: 'static + Send + Sync + FromStr<Err = Error> + Debug + Clone {
type Connection: Connection + ?Sized;
// Required methods
fn from_url(url: &Url) -> Result<Self, Error>;
fn connect(
&self
) -> Pin<Box<dyn Future<Output = Result<Self::Connection, Error>> + Send + '_>>
where Self::Connection: Sized;
fn log_statements(self, level: LevelFilter) -> Self;
fn log_slow_statements(self, level: LevelFilter, duration: Duration) -> Self;
// Provided method
fn disable_statement_logging(self) -> Self { ... }
}
Required Associated Types§
type Connection: Connection + ?Sized
Required Methods§
sourcefn connect(
&self
) -> Pin<Box<dyn Future<Output = Result<Self::Connection, Error>> + Send + '_>>where
Self::Connection: Sized,
fn connect( &self ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, Error>> + Send + '_>>where Self::Connection: Sized,
Establish a new database connection with the options specified by self
.
sourcefn log_statements(self, level: LevelFilter) -> Self
fn log_statements(self, level: LevelFilter) -> Self
Log executed statements with the specified level
sourcefn log_slow_statements(self, level: LevelFilter, duration: Duration) -> Self
fn log_slow_statements(self, level: LevelFilter, duration: Duration) -> Self
Log executed statements with a duration above the specified duration
at the specified level
.
Provided Methods§
sourcefn disable_statement_logging(self) -> Self
fn disable_statement_logging(self) -> Self
Entirely disables statement logging (both slow and regular).
Object Safety§
This trait is not object safe.