Document throwing row accessors

This commit is contained in:
Gwendal Roué committed 2025-07-20 14:38:15 +02:00
1 parent b572982e34
commit a46f3b69e9
1 file changed
+7
+7
View File
@@ -843,6 +843,13 @@ row[...] as Int
row[...] as Int?
```
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:
```swift
let name = try row.decode(String.self, atIndex: 0)
let bookCount = try row.decode(Int.self, forColumn: "bookCount")
```
> **Warning**: avoid the `as!` and `as?` operators:
>
> ```swift