Update RowConvertible documentation

This commit is contained in:
Gwendal Roué committed 2015-12-15 09:10:30 +01:00
1 parent 6b75a8e143
commit c2ba3da429
2 files changed
+6 -6

No files matched your search

+4 -4
View File
@@ -1492,9 +1492,9 @@ struct Person : RowConvertible {
static func fromRow(row: Row) -> Person {
return Person(
id: row.value(named: "id"), // mandatory column
name: row.value(named: "name"), // mandatory column
bookCount: row["bookCount"]?.value()) // optional column
id: row.value(named: "id"),
name: row.value(named: "name"),
bookCount: row.value(named: "bookCount")) // nil if column is missing
}
// The returned persons have a value in their bookCount property:
@@ -1508,7 +1508,7 @@ struct Person : RowConvertible {
}
```
See [Rows as Dictionaries](#rows-as-dictionaries) for more information about the `row["bookCount"]?.value()` expression.
See [Column Values](#column-values) for more information about the `row.value()` method.
### DatabasePersistable Protocol
+2 -2
View File
@@ -10,10 +10,10 @@
- [ ] didInsertWithRowID(_:forColumn:)
- [ ] databaseEdited -> hasDatabaseChanges, hasNotPersistedChanges ? Check if doc makes it clear that the changes are based on last fetch. The method name should make it clear too.
- [ ] Read conversion methods conventions (fromRow, fromDatabaseValue)
- [ ] Row.value(named:) should return nil if column is not there.
- [X] Row.value(named:) should return nil if column is not there.
- [X] Row.value(named:) returns nil if column is not there.
- [X] Update Row documentation
- [ ] Update "Optional Columns" chapter of RowConvertible documentation
- [X] Update "Optional Columns" chapter of RowConvertible documentation
- [ ] Conversion should crash when type mismatch (Optional<String>.fetchOne(db, "SELECT 1"))
- [ ] Record:
- [X] Remove reloading