Skip to content

Drift 2.5.0

Compare
Choose a tag to compare
@simolus3 simolus3 released this 29 Jan 15:58
· 1214 commits to develop since this release
drift-2.5.0
e42dd91

This release adds support for general IS operators to the query builder, makes drift isolates much easier to use and allows applying type converters on columns in queries.

Query builder

  • Add isExp, isValue, isNotExp and isNotValue methods to Expression to generate the IS operator in SQL.
  • Add all() extension on tables and views to quickly query all rows.

Isolate improvements

  • Add serializableConnection() and computeWithDatabase() as extensions on databases. The methods allow sharing any drift database between isolates, regardless of how the database has been set up.
  • The DatabaseConnection class now implements QueryExecutor, meaning that you no longer need a special .connect() constructor to use it.
  • The generate_connect_constructor option is now deprecated, as a DatabaseConnection can be passed whereever a QueryExecutor is used too.

Drift files

  • Support MAPPED BY for individual columns in queries or in views defined with SQL.
  • Support a CAST to an enum type in drift files.
  • Consistently interpret CAST (x AS DATETIME) and CAST(x AS TEXT) in drift files.
  • Support two different queries using LIST() columns having the same result class name.

Miscellaneous changes and fixes

  • Fix table classes not extending defining Dart classes with modular generation.
  • Fix @UseDataClass with extending not working with modular generation.
  • Fix generating invalid code when using a type converter with a nullable JSON type.
  • Avoid unecessary async modifier when mapping queries to existing row classes.