pub struct Config {
pub database_url_var: Option<String>,
}Available on crate feature
_unstable-docs only.Expand description
Configuration shared by multiple components.
Fieldsยง
ยงdatabase_url_var: Option<String>Override the database URL environment variable.
This is used by both the macros and sqlx-cli.
Case-sensitive. Defaults to DATABASE_URL.
ยงExample: Multi-Database Project
You can use multiple databases in the same project by breaking it up into multiple crates, then using a different environment variable for each.
For example, with two crates in the workspace named foo and bar:
ยงfoo/sqlx.toml
[common]
database-url-var = "FOO_DATABASE_URL"ยงbar/sqlx.toml
[common]
database-url-var = "BAR_DATABASE_URL"ยง.env
FOO_DATABASE_URL=postgres://postgres@localhost:5432/foo
BAR_DATABASE_URL=postgres://postgres@localhost:5432/barThe query macros used in foo will use FOO_DATABASE_URL,
and the ones used in bar will use BAR_DATABASE_URL.
Implementationsยง
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more
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> โ
Converts
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> โ
Converts
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