Skip to content

Instantly share code, notes, and snippets.

@weiznich
Created October 10, 2018 19:31
Show Gist options
  • Save weiznich/aa260548d229e03b9ec631d0395d7d3a to your computer and use it in GitHub Desktop.
Save weiznich/aa260548d229e03b9ec631d0395d7d3a to your computer and use it in GitHub Desktop.
diesel
diff --git a/diesel/src/lib.rs b/diesel/src/lib.rs
index 466a8b49d..efb189678 100644
--- a/diesel/src/lib.rs
+++ b/diesel/src/lib.rs
@@ -245,10 +245,6 @@ pub mod helper_types {
/// Represents the return type of `.filter(lhs.eq(rhs))`
pub type FindBy<Source, Column, Value> = Filter<Source, Eq<Column, Value>>;
- /// Represents the return type of `.for_update()`
- #[cfg(feature = "with-deprecated")]
- #[allow(deprecated)]
- pub type ForUpdate<Source> = <Source as ForUpdateDsl>::Output;
/// Represents the return type of `.for_update()`
#[cfg(not(feature = "with-deprecated"))]
diff --git a/diesel/src/query_dsl/locking_dsl.rs b/diesel/src/query_dsl/locking_dsl.rs
index eb22088c8..aef3e9985 100644
--- a/diesel/src/query_dsl/locking_dsl.rs
+++ b/diesel/src/query_dsl/locking_dsl.rs
@@ -1,40 +1,6 @@
-#[cfg(feature = "with-deprecated")]
-use query_builder::locking_clause::ForUpdate;
use query_builder::AsQuery;
use query_source::Table;
-/// The `for_update` method
-///
-/// This trait should not be relied on directly by most apps. Its behavior is
-/// provided by [`QueryDsl`]. However, you may need a where clause on this trait
-/// to call `for_update` from generic code.
-///
-/// [`QueryDsl`]: ../trait.QueryDsl.html
-#[cfg(feature = "with-deprecated")]
-#[deprecated(since = "1.3.0", note = "use `LockingDsl<ForUpdate>` instead")]
-pub trait ForUpdateDsl {
- /// The type returned by `for_update`. See [`dsl::ForUpdate`] for
- /// convenient access to this type.
- ///
- /// [`dsl::ForUpdate`]: ../../dsl/type.ForUpdate.html
- type Output;
-
- /// See the trait level documentation
- 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)
- }
-}
/// Methods related to locking select statements
///
diff --git a/diesel/src/query_dsl/mod.rs b/diesel/src/query_dsl/mod.rs
index 0ecc8046b..560c9f765 100644
--- a/diesel/src/query_dsl/mod.rs
+++ b/diesel/src/query_dsl/mod.rs
@@ -64,9 +64,6 @@ pub mod methods {
pub use super::filter_dsl::*;
pub use super::limit_dsl::LimitDsl;
pub use super::load_dsl::{ExecuteDsl, LoadQuery};
- #[cfg(feature = "with-deprecated")]
- #[allow(deprecated)]
- pub use super::locking_dsl::ForUpdateDsl;
pub use super::locking_dsl::{LockingDsl, ModifyLockDsl};
pub use super::nullable_select_dsl::SelectNullableDsl;
pub use super::offset_dsl::OffsetDsl;
@@ -787,29 +784,6 @@ pub trait QueryDsl: Sized {
methods::OffsetDsl::offset(self, offset)
}
- /// Adds `FOR UPDATE` to the end of the select statement.
- ///
- /// This method is only available for MySQL and PostgreSQL. SQLite does not
- /// provide any form of row locking.
- ///
- /// Additionally, `.for_update` cannot be used on queries with a distinct
- /// clause, group by clause, having clause, or any unions. Queries with
- /// a `FOR UPDATE` clause cannot be boxed.
- ///
- /// # Example
- ///
- /// ```ignore
- /// // Executes `SELECT * FROM users FOR UPDATE`
- /// users.for_update().load(&connection)
- /// ```
- #[cfg(feature = "with-deprecated")]
- #[allow(deprecated)]
- fn for_update(self) -> ForUpdate<Self>
- where
- Self: methods::ForUpdateDsl,
- {
- methods::ForUpdateDsl::for_update(self)
- }
/// Adds `FOR UPDATE` to the end of the select statement.
///
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment