pub struct DB;Expand description
Facade DB bergaya Laravel untuk akses database dan transaksi cepat tanpa repot.
Implementations§
Source§impl DB
impl DB
Sourcepub async fn begin(pool: &DatabasePool) -> Result<Transaction, Error>
pub async fn begin(pool: &DatabasePool) -> Result<Transaction, Error>
Mulai transaksi database baru (ACID Transaction) menggunakan pool yang diberikan.
Contoh: let tx = DB::begin(req.db()).await?;
Sourcepub async fn begin_transaction(
pool: &DatabasePool,
) -> Result<Transaction, Error>
pub async fn begin_transaction( pool: &DatabasePool, ) -> Result<Transaction, Error>
Alias untuk begin()
Sourcepub async fn transaction<F, Fut, R, E>(
pool: &DatabasePool,
callback: F,
) -> Result<R, E>
pub async fn transaction<F, Fut, R, E>( pool: &DatabasePool, callback: F, ) -> Result<R, E>
Jalankan blok transaksi otomatis (Commit jika Ok, Rollback otomatis jika Err).
Auto Trait Implementations§
impl Forget for DB
impl Freeze for DB
impl Move for DB
impl RefUnwindSafe for DB
impl Send for DB
impl Sync for DB
impl Unpin for DB
impl UnsafeUnpin for DB
impl UnwindSafe for DB
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