Initial lock support (#118)
* Initial lock support * Move methods to QuerySelect trait Co-authored-by: Marco Napetti <nappa85@therocktrading.com>
This commit is contained in:
parent
889e9df923
commit
c3084e425f
@ -3,7 +3,7 @@ use crate::{
|
|||||||
PrimaryKeyToColumn, RelationDef,
|
PrimaryKeyToColumn, RelationDef,
|
||||||
};
|
};
|
||||||
pub use sea_query::{Condition, ConditionalStatement, DynIden, JoinType, Order, OrderedStatement};
|
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 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
|
// LINT: when there is a group by clause, but some columns don't have aggregate functions
|
||||||
@ -140,6 +140,24 @@ pub trait QuerySelect: Sized {
|
|||||||
.join(join, rel.from_tbl.clone(), join_condition(rel));
|
.join(join, rel.from_tbl.clone(), join_condition(rel));
|
||||||
self
|
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
|
// LINT: when the column does not appear in tables selected from
|
||||||
|
Loading…
x
Reference in New Issue
Block a user