manager: Allow passing null to sqlEquals

Closes https://github.com/simolus3/drift/issues/3692
This commit is contained in:
Simon Binder
2025-10-26 23:39:30 +01:00
parent 4e8fe8554b
commit a3d8555f17
+9 -2
View File
@@ -21,8 +21,15 @@ 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) {
return $composableFilter(column.equals(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.