Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upThings to fix once specialization is in stable #130
Comments
added a commit
that referenced
this issue
Jan 23, 2016
sgrif
referenced this issue
Jan 23, 2016
Merged
Make `ToSql` and `FromSql` generic over the backend #131
This comment has been minimized.
|
We can probably use default impl<DB, T> QueryFragment<DB> for T where
DB: Backend,
T: BinaryQueryFragment<DB>,
{
fn is_safe_to_cache_prepared(&self) -> bool {
self.left().is_safe_to_cache_prepared() &&
self.right().is_safe_to_cache_prepared()
}
}Right now I'm having to manually add these for a ton of nodes, and it's quite painful |
This comment has been minimized.
|
We should see if we can remove the need to ever specify But right now if a type forgets to implement it, the error message is really hard to track down. It's similar to if |
added a commit
to rogeruiz/tick
that referenced
this issue
Nov 21, 2016
This comment has been minimized.
|
I'd like to have just befor<'a> &'a str: ToSql<VarChar, T::Backend>, and use an ad-hoc insert in that file. However, that's going to fail because ColumnInsertValue requires that DB: SupportsDefaultKeyword or DB == Sqlite. With specialization we can make the SQLite impl a blanket impl, and then specialize it for DB: SupportsDefaultKeyword.
|
sgrif commentedJan 23, 2016
This list is probably non-exhaustive, but we should try and add to it as we remember issues or new ones come up
FromSqlRow. This should entirely be covered byFromSqlimpliesFromSqlRowand our tuple impls. The addition of theDBparameter made this invalid under coherence, but we can hopefully go back to our old system w/ specializationFromSqlRowimplyQueryableWe should be able to remove theThis would have required latticeselectable_column_workaround!macro, and be able to writeimpl<Left, Right, T, ST> SelectableColumn<JoinSource<Left, Right>, ST> for T where T: SelectableColumn<Left>andimpl<Left, Right, T, ST> SelectableColumn<JoinSource<Left, Right>, ST> for T where T: SelectableColumn<Right>.ReplaceWhat we really want here is negative reasoning. Most of these cases we don't want to specialize for SQLite, we want to implement a trait for everything except SQLite.SupportsReturningClauseandSupportsDefaultKeywordwith a blanket impl and a refinement for SQLite. This will likely mean that we can simplify several where clauses as well. (As far as I'm aware, SQLite is the only case where these aren't supported. Other backends should be able to specialize if this is not the case). The where clauses aboutInsertablein the migrations mod can go away after this.QueryFragment<Sqlite>impl forNow-- SQLite does not have a now function. While the string'now'is technically valid on all platforms, I'd prefer to write something a little bit more "correct"