-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: floor database for events storage
- Loading branch information
Showing
9 changed files
with
299 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'dart:async'; | ||
import 'package:evently/models/events.dart'; | ||
import 'package:evently/services/third_party_services/event_dao.dart'; | ||
import 'package:floor/floor.dart'; | ||
import 'package:sqflite/sqflite.dart' as sqflite; | ||
|
||
part 'database.g.dart'; | ||
|
||
@Database(version: 6, entities: [Events]) | ||
abstract class AppDatabase extends FloorDatabase { | ||
EventsDao get eventsDao; | ||
} |
205 changes: 205 additions & 0 deletions
205
evently/lib/services/third_party_services/database.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:evently/models/events.dart'; | ||
import 'package:floor/floor.dart'; | ||
|
||
@dao | ||
abstract class EventsDao { | ||
@Query('SELECT * FROM events ORDER BY dateTime DESC') | ||
Future<List<Events>> findAllEvents(); | ||
|
||
@Query('SELECT * FROM events WHERE id = :id') | ||
Future<Events?> findEventsById(int id); | ||
|
||
@insert | ||
Future<int> insertEvents(Events events); | ||
|
||
@Query('DELETE FROM events WHERE id = :id') | ||
Future<void> delete(int id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.