mirror of https://github.com/AMT-Cheif/drift.git
Bump sqflite dependency, integration test for array args
This commit is contained in:
parent
b62ed05a87
commit
22dee72680
|
@ -7,6 +7,7 @@ description: Example apps using moor
|
||||||
|
|
||||||
|
|
||||||
We have an [example in the repo](https://github.com/simolus3/moor/tree/master/moor_flutter/example), it's a simple todo list app,
|
We have an [example in the repo](https://github.com/simolus3/moor/tree/master/moor_flutter/example), it's a simple todo list app,
|
||||||
written with moor.
|
written with moor. [Rody Davis](https://github.com/AppleEducate) has built a cleaner version of the example that works on all
|
||||||
|
Flutter platforms - including Web and Desktop! You can check it out [here](https://github.com/AppleEducate/moor_shared).
|
||||||
|
|
||||||
The [HackerNews reader app](https://github.com/filiph/hn_app) from the [Boring Flutter Show](https://www.youtube.com/playlist?list=PLjxrf2q8roU3ahJVrSgAnPjzkpGmL9Czl) also uses moor to keep a list of favorite articles.
|
The [HackerNews reader app](https://github.com/filiph/hn_app) from the [Boring Flutter Show](https://www.youtube.com/playlist?list=PLjxrf2q8roU3ahJVrSgAnPjzkpGmL9Czl) also uses moor to keep a list of favorite articles.
|
|
@ -7,7 +7,7 @@ packages:
|
||||||
name: analyzer
|
name: analyzer
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.36.4"
|
version: "0.38.3"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -21,14 +21,14 @@ packages:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.3.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -56,7 +56,7 @@ packages:
|
||||||
name: crypto
|
name: crypto
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.6"
|
version: "2.1.3"
|
||||||
csslib:
|
csslib:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -75,7 +75,7 @@ packages:
|
||||||
name: front_end
|
name: front_end
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.19"
|
version: "0.1.25"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -131,21 +131,14 @@ packages:
|
||||||
name: json_annotation
|
name: json_annotation
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.0"
|
version: "3.0.0"
|
||||||
json_rpc_2:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: json_rpc_2
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.1.0"
|
|
||||||
kernel:
|
kernel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: kernel
|
name: kernel
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.19"
|
version: "0.3.25"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -201,14 +194,14 @@ packages:
|
||||||
name: node_preamble
|
name: node_preamble
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.5"
|
version: "1.4.8"
|
||||||
package_config:
|
package_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: package_config
|
name: package_config
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.5"
|
version: "1.1.0"
|
||||||
package_resolver:
|
package_resolver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -222,14 +215,14 @@ packages:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.2"
|
version: "1.6.4"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pedantic
|
name: pedantic
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.8.0+1"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -304,7 +297,7 @@ packages:
|
||||||
name: sqflite
|
name: sqflite
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.6+2"
|
version: "1.1.6+5"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -325,7 +318,7 @@ packages:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
synchronized:
|
synchronized:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -346,21 +339,21 @@ packages:
|
||||||
name: test
|
name: test
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.3"
|
version: "1.6.10"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.5"
|
version: "0.2.7"
|
||||||
test_core:
|
test_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_core
|
name: test_core
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.5"
|
version: "0.2.9+1"
|
||||||
tests:
|
tests:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -382,13 +375,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.8"
|
version: "2.0.8"
|
||||||
vm_service_client:
|
vm_service:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service_client
|
name: vm_service
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.6+2"
|
version: "2.0.0"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -402,14 +395,14 @@ packages:
|
||||||
name: web_socket_channel
|
name: web_socket_channel
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.13"
|
version: "1.0.15"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: yaml
|
name: yaml
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.16"
|
version: "2.2.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.5.0-dev <2.6.0"
|
dart: ">=2.5.0-dev <=2.6.0-dev.1.0.flutter-7c1821c4aa"
|
||||||
flutter: ">=1.2.1 <2.0.0"
|
flutter: ">=1.2.1 <2.0.0"
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
analyzer:
|
|
||||||
plugins:
|
|
||||||
- moor
|
|
|
@ -75,6 +75,7 @@ class PreferenceConverter extends TypeConverter<Preferences, String> {
|
||||||
WHERE (f.first_user = :user OR f.second_user = :user)''',
|
WHERE (f.first_user = :user OR f.second_user = :user)''',
|
||||||
'userCount': 'SELECT COUNT(id) FROM users',
|
'userCount': 'SELECT COUNT(id) FROM users',
|
||||||
'settingsFor': 'SELECT preferences FROM users WHERE id = :user',
|
'settingsFor': 'SELECT preferences FROM users WHERE id = :user',
|
||||||
|
'usersById': 'SELECT * FROM users WHERE id IN ?',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
class Database extends _$Database {
|
class Database extends _$Database {
|
||||||
|
|
|
@ -21,7 +21,7 @@ Map<String, dynamic> _$PreferencesToJson(Preferences instance) =>
|
||||||
// MoorGenerator
|
// MoorGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: unnecessary_brace_in_string_interps
|
// ignore_for_file: unnecessary_brace_in_string_interps, unnecessary_this
|
||||||
class User extends DataClass implements Insertable<User> {
|
class User extends DataClass implements Insertable<User> {
|
||||||
final int id;
|
final int id;
|
||||||
final String name;
|
final String name;
|
||||||
|
@ -127,11 +127,11 @@ class User extends DataClass implements Insertable<User> {
|
||||||
bool operator ==(other) =>
|
bool operator ==(other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
(other is User &&
|
(other is User &&
|
||||||
other.id == id &&
|
other.id == this.id &&
|
||||||
other.name == name &&
|
other.name == this.name &&
|
||||||
other.birthDate == birthDate &&
|
other.birthDate == this.birthDate &&
|
||||||
other.profilePicture == profilePicture &&
|
other.profilePicture == this.profilePicture &&
|
||||||
other.preferences == preferences);
|
other.preferences == this.preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
class UsersCompanion extends UpdateCompanion<User> {
|
class UsersCompanion extends UpdateCompanion<User> {
|
||||||
|
@ -397,9 +397,9 @@ class Friendship extends DataClass implements Insertable<Friendship> {
|
||||||
bool operator ==(other) =>
|
bool operator ==(other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
(other is Friendship &&
|
(other is Friendship &&
|
||||||
other.firstUser == firstUser &&
|
other.firstUser == this.firstUser &&
|
||||||
other.secondUser == secondUser &&
|
other.secondUser == this.secondUser &&
|
||||||
other.reallyGoodFriends == reallyGoodFriends);
|
other.reallyGoodFriends == this.reallyGoodFriends);
|
||||||
}
|
}
|
||||||
|
|
||||||
class FriendshipsCompanion extends UpdateCompanion<Friendship> {
|
class FriendshipsCompanion extends UpdateCompanion<Friendship> {
|
||||||
|
@ -630,6 +630,23 @@ abstract class _$Database extends GeneratedDatabase {
|
||||||
return settingsForQuery(user).watch();
|
return settingsForQuery(user).watch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Selectable<User> usersByIdQuery(List<int> var1) {
|
||||||
|
var $arrayStartIndex = 1;
|
||||||
|
final expandedvar1 = $expandVar($arrayStartIndex, var1.length);
|
||||||
|
$arrayStartIndex += var1.length;
|
||||||
|
return customSelectQuery('SELECT * FROM users WHERE id IN ($expandedvar1)',
|
||||||
|
variables: [for (var $ in var1) Variable.withInt($)],
|
||||||
|
readsFrom: {users}).map(_rowToUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<User>> usersById(List<int> var1) {
|
||||||
|
return usersByIdQuery(var1).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
Stream<List<User>> watchUsersById(List<int> var1) {
|
||||||
|
return usersByIdQuery(var1).watch();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<TableInfo> get allTables => [users, friendships];
|
List<TableInfo> get allTables => [users, friendships];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
CREATE TABLE test (
|
|
||||||
id INT NOT NULL PRIMARY AUTOINCREMENT
|
|
||||||
)
|
|
|
@ -23,4 +23,13 @@ void crudTests(TestExecutor executor) {
|
||||||
await db.makeFriends(a, b);
|
await db.makeFriends(a, b);
|
||||||
await expectation;
|
await expectation;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('IN ? expressions can be expanded', () async {
|
||||||
|
// regression test for https://github.com/simolus3/moor/issues/156
|
||||||
|
final db = Database(executor.createExecutor());
|
||||||
|
|
||||||
|
final result = await db.usersById([1, 2, 3]);
|
||||||
|
|
||||||
|
expect(result.map((u) => u.name), ['Dash', 'Duke', 'Go Gopher']);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,34 @@
|
||||||
# Generated by pub
|
# Generated by pub
|
||||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||||
packages:
|
packages:
|
||||||
|
archive:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: archive
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.10"
|
||||||
|
args:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: args
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.5.2"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.3.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -29,6 +43,20 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.14.11"
|
version: "1.14.11"
|
||||||
|
convert:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: convert
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.1"
|
||||||
|
crypto:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: crypto
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.3"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -39,6 +67,13 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
image:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.4"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -52,35 +87,42 @@ packages:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.6"
|
version: "1.1.7"
|
||||||
moor:
|
moor:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "../moor"
|
path: "../moor"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "1.7.1"
|
version: "1.7.2"
|
||||||
path:
|
path:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.2"
|
version: "1.6.4"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pedantic
|
name: pedantic
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.8.0+1"
|
||||||
|
petitparser:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: petitparser
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.4.0"
|
||||||
quiver:
|
quiver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: quiver
|
name: quiver
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.5"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -99,7 +141,7 @@ packages:
|
||||||
name: sqflite
|
name: sqflite
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.6+4"
|
version: "1.1.6+5"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -120,7 +162,7 @@ packages:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
synchronized:
|
synchronized:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -156,6 +198,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.8"
|
version: "2.0.8"
|
||||||
|
xml:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: xml
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.5.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.2.2 <3.0.0"
|
dart: ">=2.4.0 <3.0.0"
|
||||||
flutter: ">=1.2.1 <2.0.0"
|
flutter: ">=1.2.1 <2.0.0"
|
||||||
|
|
|
@ -13,7 +13,7 @@ environment:
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
moor: ^1.7.0
|
moor: ^1.7.0
|
||||||
sqflite: ^1.1.0
|
sqflite: ^1.1.6+5
|
||||||
meta: ^1.0.0
|
meta: ^1.0.0
|
||||||
path: ^1.0.0
|
path: ^1.0.0
|
||||||
flutter:
|
flutter:
|
||||||
|
|
Loading…
Reference in New Issue