forked from pinchbv/floor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add support for @DatabaseView annotations
This adds initial support for @DatabaseView annotations known from room. One test was added, further testing is needed. Implements pinchbv#130.
- Loading branch information
Showing
23 changed files
with
448 additions
and
52 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,14 @@ | ||
/// Marks a class as a database view (a fixed select statement). | ||
class DatabaseView { | ||
/// The table name of the SQLite view. | ||
final String viewName; | ||
|
||
/// The SELECT query on which the view is based on. | ||
final String query; | ||
|
||
/// Marks a class as a database entity (table). | ||
const DatabaseView( | ||
this.query, { | ||
this.viewName, | ||
}); | ||
} |
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
19 changes: 19 additions & 0 deletions
19
floor_generator/lib/processor/error/view_processor_error.dart
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,19 @@ | ||
import 'package:analyzer/dart/element/element.dart'; | ||
import 'package:source_gen/source_gen.dart'; | ||
|
||
class ViewProcessorError { | ||
final ClassElement _classElement; | ||
|
||
ViewProcessorError(final ClassElement classElement) | ||
: assert(classElement != null), | ||
_classElement = classElement; | ||
|
||
InvalidGenerationSourceError get MISSING_QUERY { | ||
return InvalidGenerationSourceError( | ||
'There is no SELECT Query defined on the entity ${_classElement.displayName}.', | ||
todo: | ||
'Define a SELECT query for this View with @DatabaseView(\'SELECT [...]\') ', | ||
element: _classElement, | ||
); | ||
} | ||
} |
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.