diff --git a/README.md b/README.md index 4299aefff..6145c23ff 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/TODO.md b/TODO.md index 22ce5b7f2..dcda4d272 100644 --- a/TODO.md +++ b/TODO.md @@ -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.fetchOne(db, "SELECT 1")) - [ ] Record: - [X] Remove reloading