fix insert

This commit is contained in:
Tobe O 2019-03-14 05:21:53 -04:00
parent dbb2487c5c
commit 4453580cd8
17 changed files with 10 additions and 4 deletions

0
angel_orm/.gitignore vendored Executable file → Normal file
View file

4
angel_orm/CHANGELOG.md Executable file → Normal file
View file

@ -1,3 +1,7 @@
# 2.0.0-dev.22
* `compileInsert` will explicitly never emit a key not belonging to the
associated query.
# 2.0.0-dev.21 # 2.0.0-dev.21
* Add tableName to query * Add tableName to query

0
angel_orm/LICENSE Executable file → Normal file
View file

0
angel_orm/README.md Executable file → Normal file
View file

0
angel_orm/analysis_options.yaml Executable file → Normal file
View file

0
angel_orm/example/main.angel_serialize.g.part Executable file → Normal file
View file

0
angel_orm/example/main.dart Executable file → Normal file
View file

0
angel_orm/example/main.g.dart Executable file → Normal file
View file

0
angel_orm/example/main.serializer.g.dart Executable file → Normal file
View file

0
angel_orm/lib/angel_orm.dart Executable file → Normal file
View file

0
angel_orm/lib/src/annotations.dart Executable file → Normal file
View file

0
angel_orm/lib/src/builder.dart Executable file → Normal file
View file

0
angel_orm/lib/src/migration.dart Executable file → Normal file
View file

4
angel_orm/lib/src/query.dart Executable file → Normal file
View file

@ -397,7 +397,9 @@ abstract class QueryValues {
} }
String compileInsert(Query query, String tableName) { String compileInsert(Query query, String tableName) {
var data = toMap(); var data = Map<String, dynamic>.from(toMap());
var keys = data.keys.toList();
keys.where((k) => !query.fields.contains(k)).forEach(data.remove);
if (data.isEmpty) return null; if (data.isEmpty) return null;
var fieldSet = data.keys.join(', '); var fieldSet = data.keys.join(', ');

0
angel_orm/lib/src/relations.dart Executable file → Normal file
View file

0
angel_orm/mono_pkg.yaml Executable file → Normal file
View file

2
angel_orm/pubspec.yaml Executable file → Normal file
View file

@ -1,5 +1,5 @@
name: angel_orm name: angel_orm
version: 2.0.0-dev.21 version: 2.0.0-dev.22
description: Runtime support for Angel's ORM. Includes base classes for queries. description: Runtime support for Angel's ORM. Includes base classes for queries.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/orm homepage: https://github.com/angel-dart/orm