chore: Move the drift_offline_first to legacy in favor of Serverpod implementation (#32)
This commit is contained in:
parent
027aec5ed0
commit
cbc472523b
1 changed files with 13575 additions and 284 deletions
34
legacy/drift_offline_sync/test/utils/views.dart
Normal file
34
legacy/drift_offline_sync/test/utils/views.dart
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import 'package:drift/drift.dart';
|
||||
|
||||
import 'tables.dart';
|
||||
|
||||
abstract class CategoryTodoCountView extends View {
|
||||
TodosTable get todos;
|
||||
Categories get categories;
|
||||
|
||||
Expression<int> get categoryId => categories.id;
|
||||
Expression<String> get description => categories.description + const Variable('!');
|
||||
Expression<int> get itemCount => todos.id.count();
|
||||
|
||||
@override
|
||||
Query as() =>
|
||||
select(
|
||||
[categoryId, description, itemCount],
|
||||
).from(categories).join([
|
||||
innerJoin(todos, todos.category.equalsExp(categories.id)),
|
||||
])
|
||||
..groupBy([categories.id]);
|
||||
}
|
||||
|
||||
abstract class TodoWithCategoryView extends View {
|
||||
TodosTable get todos;
|
||||
Categories get categories;
|
||||
|
||||
@override
|
||||
Query as() =>
|
||||
select(
|
||||
[todos.title, categories.description],
|
||||
).from(todos).join([
|
||||
innerJoin(categories, categories.id.equalsExp(todos.category)),
|
||||
]);
|
||||
}
|
||||
Loading…
Reference in a new issue