Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial lock support #118

Merged
merged 3 commits into from
Sep 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/query/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
PrimaryKeyToColumn, RelationDef,
};
pub use sea_query::{Condition, ConditionalStatement, DynIden, JoinType, Order, OrderedStatement};
use sea_query::{Expr, IntoCondition, SeaRc, SelectExpr, SelectStatement, SimpleExpr, TableRef};
use sea_query::{Expr, IntoCondition, LockType, SeaRc, SelectExpr, SelectStatement, SimpleExpr, TableRef};

// LINT: when the column does not appear in tables selected from
// LINT: when there is a group by clause, but some columns don't have aggregate functions
Expand Down Expand Up @@ -140,6 +140,24 @@ pub trait QuerySelect: Sized {
.join(join, rel.from_tbl.clone(), join_condition(rel));
self
}

/// Select lock
fn lock(mut self, lock_type: LockType) -> Self {
self.query().lock(lock_type);
self
}

/// Select lock shared
fn lock_shared(mut self) -> Self {
self.query().lock_shared();
self
}

/// Select lock exclusive
fn lock_exclusive(mut self) -> Self {
self.query().lock_exclusive();
self
}
}

// LINT: when the column does not appear in tables selected from
Expand Down