Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
#9. Ignore annotation will exclude the field
Browse files Browse the repository at this point in the history
  • Loading branch information
matei-tm committed Mar 14, 2019
1 parent 8a84822 commit 8690e55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/generator/model_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class ModelParser {
if (rawEntityAttributes.length == 0) return;

var firstField = rawEntityAttributes.first;

if (mustIgnore(firstField.metadataLevel)) return;

if (firstField is EntityAttribute) {
entityAttributes[firstField.modelName] = firstField;
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/generator/utils/entity_attribute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class EntityAttribute {

final String attributeName;

final int metadataLevel;

EntityAttribute(this.modelTypeName, this.modelName, this.attributeName,
{int metadataLevel});
{this.metadataLevel});
}
6 changes: 6 additions & 0 deletions src/test/src/model/healthy_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ class HealthEntry implements DbEntity {
@DataColumn("my_description_column", ColumnMetadata.Unique)
String _description;

@DataColumn(
"my_future_column",
ColumnMetadata.Ignore |
ColumnMetadata.Unique)
int _futureData;

@override
int get id => _id;

Expand Down

0 comments on commit 8690e55

Please sign in to comment.