-
Notifications
You must be signed in to change notification settings - Fork 192
/
Copy pathtask_dao.dart
41 lines (29 loc) · 1000 Bytes
/
task_dao.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import 'package:example/task.dart';
import 'package:floor/floor.dart';
@dao
abstract class TaskDao {
@Query('SELECT * FROM task WHERE id = :id')
Future<Task?> findTaskById(int id);
@Query('SELECT * FROM task')
Future<List<Task>> findAllTasks();
@Query('SELECT * FROM task')
Stream<List<Task>> findAllTasksAsStream();
@Query('SELECT DISTINCT COUNT(message) FROM task')
Stream<int?> findUniqueMessagesCountAsStream();
@Query('SELECT * FROM task WHERE status = :status')
Stream<List<Task>> findAllTasksByStatusAsStream(TaskStatus status);
@Query('UPDATE OR ABORT Task SET type = :type WHERE id = :id')
Future<int?> updateTypeById(TaskType type, int id);
@insert
Future<void> insertTask(Task task);
@insert
Future<void> insertTasks(List<Task> tasks);
@update
Future<void> updateTask(Task task);
@update
Future<void> updateTasks(List<Task> task);
@delete
Future<void> deleteTask(Task task);
@delete
Future<void> deleteTasks(List<Task> tasks);
}