It uses prepared statements internally, just like every other part of diesels api.
Using this layered approach will involve a significant performance overhead because you need to go back and forth between a typed representation and several string representations. (As seen from the 6. layer). Diesel does currently something differently in some cases: It skips building the actual sql query, because we have already build that query before and it’s now in the prepared statement cache. The corresponding prepared statement could be received using a statically known type id. Such optimizations cannot work if you have to pass a sql statement though several layers that expect some sort of sql string.
Returning a “non-exhaustive enum of all possible types across all databases” is not an option here because some database systems allow user defined types.
How would that be to the currently provided derives for Queryable, Insertable and AsChangeset?