#[cfg(feature = "with-deprecated")]
use query_builder::locking_clause::ForUpdate;
use query_builder::AsQuery;
use query_source::Table;
#[cfg(feature = "with-deprecated")]
#[deprecated(since = "1.3.0", note = "use `LockingDsl<ForUpdate>` instead")]
pub trait ForUpdateDsl {
type Output;
fn for_update(self) -> Self::Output;
}
#[cfg(feature = "with-deprecated")]
#[allow(deprecated)]
impl<T> ForUpdateDsl for T
where
T: LockingDsl<ForUpdate>,
{
type Output = <T as LockingDsl<ForUpdate>>::Output;
fn for_update(self) -> Self::Output {
self.with_lock(ForUpdate)
}
}
pub trait LockingDsl<Lock> {
type Output;
fn with_lock(self, lock: Lock) -> Self::Output;
}
impl<T, Lock> LockingDsl<Lock> for T
where
T: Table + AsQuery,
T::Query: LockingDsl<Lock>,
{
type Output = <T::Query as LockingDsl<Lock>>::Output;
fn with_lock(self, lock: Lock) -> Self::Output {
self.as_query().with_lock(lock)
}
}
pub trait ModifyLockDsl<Modifier> {
type Output;
fn modify_lock(self, modifier: Modifier) -> Self::Output;
}