Skip to content

Commit

Permalink
Update floor version to 0.13.0 & update README.md for implementing em…
Browse files Browse the repository at this point in the history
…bedded objects
  • Loading branch information
hsul4n committed May 14, 2020
1 parent 788186a commit aa90fb6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ With the annotation, it's possible to give columns a custom name and define if t
- Floor automatically uses the **first** constructor defined in the entity class for creating in-memory objects from database rows.
- There needs to be a constructor.

`@Embedded` includes annotationed class fields to be embedded to SQL query as if they are fields but from another class.
You can specifies a `prefix` to prepend the column names of the fields in the embedded fields.

#### Limitations
- Floor automatically uses the **first** constructor defined in the entity class for creating in-memory objects from database rows.
- There needs to be a constructor.

```dart
@Entity(tableName: 'person')
class Person {
Expand All @@ -210,7 +217,16 @@ class Person {
@ColumnInfo(name: 'custom_name', nullable: false)
final String name;
Person(this.id, this.name);
@Embedded(prefix: 'custom_prefix')
final Address address;
Person(this.id, this.name, this.address);
}
class Address {
final String street;
Address(this.street);
}
```

Expand Down
6 changes: 6 additions & 0 deletions floor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

# 0.13.0

### 🚀 Features

* Support embedded objects

# 0.12.0

### Changes
Expand Down
14 changes: 13 additions & 1 deletion floor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ 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`.

`@Embedded` includes annotationed class fields to be embedded to SQL query as if they are fields but from another class.
You can specifies a `prefix` to prepend the column names of the fields in the embedded fields.

#### Limitations
- Floor automatically uses the **first** constructor defined in the entity class for creating in-memory objects from database rows.
- There needs to be a constructor.
Expand All @@ -210,7 +213,16 @@ class Person {
@ColumnInfo(name: 'custom_name', nullable: false)
final String name;
Person(this.id, this.name);
@Embedded(prefix: 'custom_prefix')
final Address address;
Person(this.id, this.name, this.address);
}
class Address {
final String street;
Address(this.street);
}
```

Expand Down
2 changes: 1 addition & 1 deletion floor/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: floor
description: >
A supportive SQLite abstraction for your Flutter applications.
This library is the runtime dependency.
version: 0.12.0
version: 0.13.0
homepage: https://github.com/vitusortner/floor
author: Vitus Ortner <[email protected]>

Expand Down

0 comments on commit aa90fb6

Please sign in to comment.