Nullable date aggregates

This commit is contained in:
Simon Binder 2022-06-22 12:18:10 +02:00
parent 3331d625b0
commit 84cf9b82c3
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
3 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,8 @@
## 1.8.0-dev
## 2.0.0-dev
- Consistently handle transaction errors like a failing `BEGIN` or `COMMIT`
across database implementations.
- Fix nullability of `min`, `max` and `avg` in the Dart query builder.
## 1.7.0

View File

@ -159,21 +159,21 @@ extension BigIntAggregates<DT extends BigInt> on Expression<DT?> {
extension DateTimeAggregate on Expression<DateTime?> {
/// Return the average of all non-null values in this group.
/// {@macro drift_aggregate_filter}
Expression<DateTime> avg({Expression<bool?>? filter}) =>
Expression<DateTime?> avg({Expression<bool?>? filter}) =>
secondsSinceEpoch.avg(filter: filter).roundToInt().dartCast();
/// Return the maximum of all non-null values in this group.
///
/// If there are no non-null values in the group, returns null.
/// {@macro drift_aggregate_filter}
Expression<DateTime> max({Expression<bool?>? filter}) =>
Expression<DateTime?> max({Expression<bool?>? filter}) =>
_AggregateExpression('MAX', [this], filter: filter);
/// Return the minimum of all non-null values in this group.
///
/// If there are no non-null values in the group, returns null.
/// {@macro drift_aggregate_filter}
Expression<DateTime> min({Expression<bool?>? filter}) =>
Expression<DateTime?> min({Expression<bool?>? filter}) =>
_AggregateExpression('MIN', [this], filter: filter);
}

View File

@ -1,6 +1,6 @@
name: drift
description: Drift is a reactive library to store relational data in Dart and Flutter applications.
version: 1.8.0-dev
version: 2.0.0-dev
repository: https://github.com/simolus3/drift
homepage: https://drift.simonbinder.eu/
issue_tracker: https://github.com/simolus3/drift/issues