mirror of https://github.com/AMT-Cheif/drift.git
Update build config in testcases
This commit is contained in:
parent
ef30349bc6
commit
aa1d279b8e
|
@ -4,11 +4,20 @@ targets:
|
|||
drift_dev:
|
||||
options:
|
||||
override_hash_and_equals_in_result_sets: true
|
||||
use_column_name_as_json_key_when_defined_in_moor_file: true
|
||||
generate_connect_constructor: true
|
||||
compact_query_methods: true
|
||||
write_from_json_string_constructor: true
|
||||
raw_result_set_data: false
|
||||
apply_converters_on_variables: true
|
||||
generate_values_in_copy_with: true
|
||||
named_parameters: false
|
||||
new_sql_code_generation: true
|
||||
scoped_dart_components: true
|
||||
sql:
|
||||
dialect: sqlite
|
||||
options:
|
||||
version: "3.37"
|
||||
modules:
|
||||
- json1
|
||||
- fts5
|
||||
- fts5
|
||||
|
|
|
@ -93,6 +93,10 @@ class User extends DataClass implements Insertable<User> {
|
|||
preferences: serializer.fromJson<Preferences?>(json['preferences']),
|
||||
);
|
||||
}
|
||||
factory User.fromJsonString(String encodedJson,
|
||||
{ValueSerializer? serializer}) =>
|
||||
User.fromJson(DataClass.parseJson(encodedJson) as Map<String, dynamic>,
|
||||
serializer: serializer);
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
|
@ -109,14 +113,15 @@ class User extends DataClass implements Insertable<User> {
|
|||
{int? id,
|
||||
String? name,
|
||||
DateTime? birthDate,
|
||||
Uint8List? profilePicture,
|
||||
Preferences? preferences}) =>
|
||||
Value<Uint8List?> profilePicture = const Value.absent(),
|
||||
Value<Preferences?> preferences = const Value.absent()}) =>
|
||||
User(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
birthDate: birthDate ?? this.birthDate,
|
||||
profilePicture: profilePicture ?? this.profilePicture,
|
||||
preferences: preferences ?? this.preferences,
|
||||
profilePicture:
|
||||
profilePicture.present ? profilePicture.value : this.profilePicture,
|
||||
preferences: preferences.present ? preferences.value : this.preferences,
|
||||
);
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -366,6 +371,11 @@ class Friendship extends DataClass implements Insertable<Friendship> {
|
|||
reallyGoodFriends: serializer.fromJson<bool>(json['reallyGoodFriends']),
|
||||
);
|
||||
}
|
||||
factory Friendship.fromJsonString(String encodedJson,
|
||||
{ValueSerializer? serializer}) =>
|
||||
Friendship.fromJson(
|
||||
DataClass.parseJson(encodedJson) as Map<String, dynamic>,
|
||||
serializer: serializer);
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
|
@ -549,7 +559,7 @@ abstract class _$Database extends GeneratedDatabase {
|
|||
late final $FriendshipsTable friendships = $FriendshipsTable(this);
|
||||
Selectable<User> mostPopularUsers(int amount) {
|
||||
return customSelect(
|
||||
'SELECT * FROM users u ORDER BY (SELECT COUNT(*) FROM friendships WHERE first_user = u.id OR second_user = u.id) DESC LIMIT :amount',
|
||||
'SELECT * FROM users AS u ORDER BY (SELECT COUNT(*) FROM friendships WHERE first_user = u.id OR second_user = u.id) DESC LIMIT ?1',
|
||||
variables: [
|
||||
Variable<int>(amount)
|
||||
],
|
||||
|
@ -561,18 +571,18 @@ abstract class _$Database extends GeneratedDatabase {
|
|||
|
||||
Selectable<int> amountOfGoodFriends(int user) {
|
||||
return customSelect(
|
||||
'SELECT COUNT(*) FROM friendships f WHERE f.really_good_friends = 1 AND (f.first_user = :user OR f.second_user = :user)',
|
||||
'SELECT COUNT(*) AS _c0 FROM friendships AS f WHERE f.really_good_friends = 1 AND(f.first_user = ?1 OR f.second_user = ?1)',
|
||||
variables: [
|
||||
Variable<int>(user)
|
||||
],
|
||||
readsFrom: {
|
||||
friendships,
|
||||
}).map((QueryRow row) => row.read<int>('COUNT(*)'));
|
||||
}).map((QueryRow row) => row.read<int>('_c0'));
|
||||
}
|
||||
|
||||
Selectable<FriendshipsOfResult> friendshipsOf(int user) {
|
||||
return customSelect(
|
||||
'SELECT\n f.really_good_friends, "user"."id" AS "nested_0.id", "user"."name" AS "nested_0.name", "user"."birth_date" AS "nested_0.birth_date", "user"."profile_picture" AS "nested_0.profile_picture", "user"."preferences" AS "nested_0.preferences"\n FROM friendships f\n INNER JOIN users "user" ON "user".id IN (f.first_user, f.second_user) AND\n "user".id != :user\n WHERE (f.first_user = :user OR f.second_user = :user)',
|
||||
'SELECT f.really_good_friends,"user"."id" AS "nested_0.id", "user"."name" AS "nested_0.name", "user"."birth_date" AS "nested_0.birth_date", "user"."profile_picture" AS "nested_0.profile_picture", "user"."preferences" AS "nested_0.preferences" FROM friendships AS f INNER JOIN users AS user ON user.id IN (f.first_user, f.second_user) AND user.id != ?1 WHERE(f.first_user = ?1 OR f.second_user = ?1)',
|
||||
variables: [
|
||||
Variable<int>(user)
|
||||
],
|
||||
|
@ -588,15 +598,15 @@ abstract class _$Database extends GeneratedDatabase {
|
|||
}
|
||||
|
||||
Selectable<int> userCount() {
|
||||
return customSelect('SELECT COUNT(id) FROM users',
|
||||
return customSelect('SELECT COUNT(id) AS _c0 FROM users',
|
||||
variables: [],
|
||||
readsFrom: {
|
||||
users,
|
||||
}).map((QueryRow row) => row.read<int>('COUNT(id)'));
|
||||
}).map((QueryRow row) => row.read<int>('_c0'));
|
||||
}
|
||||
|
||||
Selectable<Preferences?> settingsFor(int user) {
|
||||
return customSelect('SELECT preferences FROM users WHERE id = :user',
|
||||
return customSelect('SELECT preferences FROM users WHERE id = ?1',
|
||||
variables: [
|
||||
Variable<int>(user)
|
||||
],
|
||||
|
@ -621,7 +631,7 @@ abstract class _$Database extends GeneratedDatabase {
|
|||
|
||||
Future<List<Friendship>> returning(int var1, int var2, bool var3) {
|
||||
return customWriteReturning(
|
||||
'INSERT INTO friendships VALUES (?, ?, ?) RETURNING *;',
|
||||
'INSERT INTO friendships VALUES (?1, ?2, ?3) RETURNING *',
|
||||
variables: [
|
||||
Variable<int>(var1),
|
||||
Variable<int>(var2),
|
||||
|
|
Loading…
Reference in New Issue