Fix booleans not working as expected in mapFromCompanion (#559)

This commit is contained in:
Simon Binder 2020-05-13 21:51:08 +02:00
parent cf830165e1
commit 5c3671b465
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
2 changed files with 5 additions and 3 deletions

View File

@ -68,9 +68,10 @@ mixin TableInfo<TableDsl extends Table, D extends DataClass> on Table
'evaluated by a database engine.');
}
final context = GenerationContext(SqlTypeSystem.defaultInstance, null);
final rawValues = asColumnMap
.cast<String, Variable>()
.map((key, value) => MapEntry(key, value.value));
.map((key, value) => MapEntry(key, value.mapToSimpleValue(context)));
return map(rawValues);
}

View File

@ -39,7 +39,8 @@ void main() {
id: Value(3),
name: Value('hi'),
profilePicture: Value.absent(),
isAwesome: Value(true),
// false for https://github.com/simolus3/moor/issues/559
isAwesome: Value(false),
);
final user = db.users.mapFromCompanion(companion);
@ -49,7 +50,7 @@ void main() {
id: 3,
name: 'hi',
profilePicture: null,
isAwesome: true,
isAwesome: false,
creationTime: null,
),
);