Comments (7)
Hi there, welcome again )
No, it's just not being thoroughly investigated yet.
from sea-orm.
@nappa85 Could you briefly explain what row locking is? I haven't heard of this before. Is this something similar to a read/write mutex but for a row in the database?
from sea-orm.
@nappa85 Could you briefly explain what row locking is? I haven't heard of this before. Is this something similar to a read/write mutex but for a row in the database?
Yeah, sure.
Row locking works only inside a transaction (or at least MySQL is designed like that), you can lock a row in 2 ways:
shared: like a RwLock::read(), done appending "FOR SHARE" at the end of the query;
exclusive: like a RwLock::write(), done appending "FOR UPDATE" at the end of the query;
You can read official docs here: https://dev.mysql.com/doc/refman/8.0/en/innodb-locking.html#innodb-shared-exclusive-locks
From a quick search, I see PostgreSQL has many more lock types: https://www.postgresql.org/docs/9.1/explicit-locking.html
I'm still not familiar with your APIs, but being only an append to a select query I see it as a set of methods of sea_orm::query::Select, aside of the existing one
, all
and paginate
, something like
fn one_lock(self, db: &DatabaseConnection, lock_tipe: LockType) -> Result<Option<E::Model>, DbErr>;
fn all_lock(self, db: &DatabaseConnection, lock_tipe: LockType) -> Result<Vec<E::Model>, DbErr>;
fn paginate_lock(self, db: &DatabaseConnection, page_size: usize, lock_tipe: LockType) -> Paginator<'_, SelectModel<E::Model>>;
from sea-orm.
Oh wow okay thats awesome thank you! I can't believe I've never come across MySQL/Postgres row locks before! Seems like a nice feature to have.
Btw I am just a strong user of SeaORM haha not a dev on it for now 😀.
from sea-orm.
I think we can close this issue, since my PR has been merged, right?
from sea-orm.
Well only the SeaQuery PR has been merged and since SeaORM has bumped the dependency, you can use it now.
It depends on whether you want additional convenience by introducing new API in SeaORM.
from sea-orm.
Well only the SeaQuery PR has been merged and since SeaORM has bumped the dependency, you can use it now.
It depends on whether you want additional convenience by introducing new API in SeaORM.
Oh, you're right, it's the sea-query PR that has been merged, not the sea-orm one
from sea-orm.
Related Issues (20)
- Issues with tables that do not have primary/unique keys
- Insert an active model and get back the last insert id doesn't work with autoincrement
- Enum column named "model" generates code that conflicts with the struct Model
- ambiguous associated type when access Entity::Column HOT 5
- TimestampWithTimeZone returned as array
- Allow Defaulting `string_value` For ActiveEnum Based On Renaming Rules On Variants HOT 1
- transaction use probelm with state
- Sea-ORM still includes sqlx-mysql dependency even when no mysql feature is enabled
- sea-orm-migration - Compile error using most recent version of rc2 HOT 12
- Missing downward feature `runtime-tokio`. HOT 4
- Mock Auto Increment ID Not Working for Postgres Backend Complaining About Null HOT 1
- sea-orm-cli generate error HOT 1
- .money_len type creates invalid SQL HOT 1
- Compilation error when building with sqlx-sqlite and runtime-async-std-rustls HOT 3
- is Sea orm Json type can't insert text [] type HOT 2
- Migration fresh command cannot drop types with Postgresql
- Clarification on Relationship Generation in sea-orm-cli Based on ForeignKey Constraints
- `find_with_related` implicitly adds ordering on `left.id` HOT 3
- In migration use enumeration
- Expose `order_by_with_nulls` in `QueryOrder` trait HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sea-orm.