mirror of
https://github.com/immich-app/drift.git
synced 2026-09-30 13:22:57 +08:00
manager: Allow passing null to sqlEquals
Closes https://github.com/simolus3/drift/issues/3692
This commit is contained in:
@@ -21,9 +21,16 @@ abstract class _BaseColumnFilters<T extends Object> {
|
||||
/// On columns with type converters, the filter operations invoked with
|
||||
/// `call` or `equals` apply the type converter. This method will always
|
||||
/// bypass any type converter that might be set on the column.
|
||||
Expression<bool> sqlEquals(T value) {
|
||||
///
|
||||
/// If [value] is null, the comparison evaluates to `false`.
|
||||
Expression<bool> sqlEquals(T? value) {
|
||||
if (value == null) {
|
||||
// A comparison to null should always be false here.
|
||||
return $composableFilter(const Constant(false));
|
||||
} else {
|
||||
return $composableFilter(column.equals(value));
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a filter that checks if the column is null.
|
||||
Expression<bool> isNull() => $composableFilter(column.isNull());
|
||||
|
||||
Reference in New Issue
Block a user