pub struct ConnectOpts {
pub no_dotenv: NoDotenvOpt,
pub database_url: Option<String>,
pub connect_timeout: u64,
pub sqlite_create_db_wal: bool,
}Expand description
Argument for the database URL.
Fields§
§no_dotenv: NoDotenvOpt§database_url: Option<String>Location of the DB, by default will be read from the DATABASE_URL env var or .env files.
connect_timeout: u64The maximum time, in seconds, to try connecting to the database server before returning an error.
sqlite_create_db_wal: boolSet whether or not to create SQLite databases in Write-Ahead Log (WAL) mode: https://www.sqlite.org/wal.html
WAL mode is enabled by default for SQLite databases created by sqlx-cli.
However, if your application sets a journal_mode on SqliteConnectOptions to something
other than Wal, then it will have to take the database file out of WAL mode on connecting,
which requires an exclusive lock and may return a database is locked (SQLITE_BUSY) error.
Implementations§
Source§impl ConnectOpts
impl ConnectOpts
Sourcepub fn expect_db_url(&self) -> Result<&str>
pub fn expect_db_url(&self) -> Result<&str>
Require a database URL to be provided, otherwise return an error.
Sourcepub fn populate_db_url(&mut self, config: &Config) -> Result<()>
pub fn populate_db_url(&mut self, config: &Config) -> Result<()>
Populate database_url from the environment, if not set.
Trait Implementations§
Source§impl Args for ConnectOpts
impl Args for ConnectOpts
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl Debug for ConnectOpts
impl Debug for ConnectOpts
Source§impl FromArgMatches for ConnectOpts
impl FromArgMatches for ConnectOpts
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Auto Trait Implementations§
impl Freeze for ConnectOpts
impl RefUnwindSafe for ConnectOpts
impl Send for ConnectOpts
impl Sync for ConnectOpts
impl Unpin for ConnectOpts
impl UnwindSafe for ConnectOpts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more