sea-query
sea-query copied to clipboard
fix #420
fix #420
Then, sea-orm call sea-query crate, not always use Object owership with use sea_query::{MysqlQueryBuilder, PostgresQueryBuilder, SqliteQueryBuilder};
From API ergonomic point of view: I favour XxxQueryBuilder over &XxxQueryBuilder
Hey @baoyachi, thanks for the contributions!!
XxxQueryBuilderis just a unit struct that serve as a construct to mark which db backend is it. Is it a performance consideration to pass by reference instead of consuming (owning) it?I doubt there is any practical performance gain @tyt2y3
Two part:
- not always create new XXXBuilder
- When I wanted to extend
sea-orm, I found that it could not be extended. The key code could not be called because this is a built-in enumeration type.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum DbBackend {
/// A MySQL backend
MySql,
/// A PostgreSQL backend
Postgres,
/// A SQLite backend
Sqlite,
}
The limit code :
pub fn exec<'a, C>(self, db: &'a C) -> impl Future<Output = Result<XXXResult<A>, DbErr>> + '_
where
C: ConnectionTrait,
A: 'a,
{
+ let builder = db.get_database_backend();
exec_insert(self.primary_key, builder.build(&self.query), db)
}
let builder = db.get_database_backend(); The builder return DbBackend,
- Now it is changed to a reference structure. I can extend the trait to the interior of sea-query. The dependency is coupled
@billy1624
I can modify it slightly so that both parameters XxxQueryBuilder and ref XxxQueryBuilder can be accepted
@billy1624 I can modify it slightly so that both parameters
XxxQueryBuilderandref XxxQueryBuildercan be accepted
That would be great! That way, it's backward compatible :)
@baoyachi hello. Do you want to continue work in this PR?
A month has passed without a response, I close.