pub struct OrmPool;Expand description
Обёртка над sqlx::PgPool с удобными методами подключения.
Implementations§
Source§impl OrmPool
impl OrmPool
Sourcepub async fn connect(url: &str) -> OrmResult<PgPool>
pub async fn connect(url: &str) -> OrmResult<PgPool>
Подключиться к БД по URL.
let pool = OrmPool::connect("postgres://user:pass@localhost/mydb").await?;Sourcepub async fn from_env() -> OrmResult<PgPool>
pub async fn from_env() -> OrmResult<PgPool>
Читает DATABASE_URL из переменных окружения.
let pool = OrmPool::from_env().await?;Sourcepub async fn connect_with_options(
url: &str,
options: PoolOptions,
) -> OrmResult<PgPool>
pub async fn connect_with_options( url: &str, options: PoolOptions, ) -> OrmResult<PgPool>
Подключение с явными параметрами пула.
Auto Trait Implementations§
impl Freeze for OrmPool
impl RefUnwindSafe for OrmPool
impl Send for OrmPool
impl Sync for OrmPool
impl Unpin for OrmPool
impl UnsafeUnpin for OrmPool
impl UnwindSafe for OrmPool
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