mirror of https://github.com/AMT-Cheif/drift.git
Fix query in example app
This commit is contained in:
parent
7d940f8fd8
commit
a3109b4a6b
|
@ -76,8 +76,9 @@ class AppDatabase extends _$AppDatabase {
|
|||
/// Returns an auto-updating stream of all todo entries in a given category
|
||||
/// id.
|
||||
Stream<List<TodoEntryWithCategory>> entriesInCategory(int? categoryId) {
|
||||
final query = select(todoEntries).join(
|
||||
[leftOuterJoin(categories, categories.id.equalsExp(todoEntries.id))]);
|
||||
final query = select(todoEntries).join([
|
||||
leftOuterJoin(categories, categories.id.equalsExp(todoEntries.category))
|
||||
]);
|
||||
|
||||
if (categoryId != null) {
|
||||
query.where(categories.id.equals(categoryId));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
part of 'database.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// MoorGenerator
|
||||
// DriftDatabaseGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
@ -655,7 +655,7 @@ abstract class _$AppDatabase extends GeneratedDatabase {
|
|||
|
||||
Selectable<SearchResult> _search(String query) {
|
||||
return customSelect(
|
||||
'SELECT"todos"."id" AS "nested_0.id", "todos"."description" AS "nested_0.description", "todos"."category" AS "nested_0.category", "todos"."due_date" AS "nested_0.due_date","cat"."id" AS "nested_1.id", "cat"."name" AS "nested_1.name", "cat"."color" AS "nested_1.color" FROM text_entries INNER JOIN todo_entries AS todos ON todos.id = text_entries."rowid" LEFT OUTER JOIN categories AS cat ON cat.id = todos.category WHERE text_entries MATCH @1 ORDER BY rank',
|
||||
'SELECT"todos"."id" AS "nested_0.id", "todos"."description" AS "nested_0.description", "todos"."category" AS "nested_0.category", "todos"."due_date" AS "nested_0.due_date","cat"."id" AS "nested_1.id", "cat"."name" AS "nested_1.name", "cat"."color" AS "nested_1.color" FROM text_entries INNER JOIN todo_entries AS todos ON todos.id = text_entries."rowid" LEFT OUTER JOIN categories AS cat ON cat.id = todos.category WHERE text_entries MATCH ?1 ORDER BY rank',
|
||||
variables: [
|
||||
Variable<String>(query)
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue