Skip to content

Commit a46f3b6

Browse files
committed
Document throwing row accessors
1 parent b572982 commit a46f3b6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,13 @@ row[...] as Int
843843
row[...] as Int?
844844
```
845845

846+
Throwing accessors exist as well. Their use is not encouraged, because a database decoding error is a programming error. If an application stores invalid data in the database file, that is a bug that needs to be fixed:
847+
848+
```swift
849+
let name = try row.decode(String.self, atIndex: 0)
850+
let bookCount = try row.decode(Int.self, forColumn: "bookCount")
851+
```
852+
846853
> **Warning**: avoid the `as!` and `as?` operators:
847854
>
848855
> ```swift

0 commit comments

Comments
 (0)