Skip to content

Commit

Permalink
Update README with ignore annotation and positional and named paramet…
Browse files Browse the repository at this point in the history
…ers (#249)
  • Loading branch information
vitusortner authored Jan 25, 2020
1 parent d048684 commit 635bae7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This package is still in an early phase and the API will likely change.
1. [Migrations](#migrations)
1. [In-Memory Database](#in-memory-database)
1. [Callback](#callback)
1. [Ignore Fields](#ignore-fields)
1. [Examples](#examples)
1. [Naming](#naming)
1. [Bugs and Feedback](#bugs-and-feedback)
Expand Down Expand Up @@ -305,6 +306,11 @@ For more information about primary keys and especially compound primary keys, re
`@ColumnInfo` enables custom mapping of single table columns.
With the annotation, it's possible to give columns a custom name and define if the column is able to store `null`.

`@ignore` excludes annotated fields from the library's mapping.
More information on that can be found in the [Ignore Fields](#ignore-fields) section.

Constructors with positional and named parameters are supported out of the box.

```dart
@Entity(tableName: 'person')
class Person {
Expand Down Expand Up @@ -456,6 +462,24 @@ final database = await $FloorAppDatabase
.build();
```

## Ignore Fields
The `hashCode` property and all static fields of entities are ignored by default and thus excluded from the library's mapping.
In case further fields should be ignored, the `@ignore` annotation should be used and applied as shown in the following snippet.

```dart
class Person {
@primaryKey
final int id;
final String name;
@ignore
String nickname;
Person(this.id, this.name);
}
```

## Examples
For further examples take a look at the [example](https://github.com/vitusortner/floor/tree/develop/example) and [floor_test](https://github.com/vitusortner/floor/tree/develop/floor_test) directories.

Expand Down

0 comments on commit 635bae7

Please sign in to comment.