Closed duncangroenewald closed 1 year ago
You should use expressions instead:
let users = Table("users")
let id = Expression<Int>("id")
let email = Expression<String>("email")
for row in try db.prepare(users.select(id, email)) {
let idAsInt = try row.get(id)
let emailAsString = try row.get(email)
// You can do whatever you want with `idAsInt` and `emailAsString` which are safe Int/String
}
This is explained in the documentation here.
I can't find any documentation that explains how to convert the returned column data to Swift types.
The example provided is singularly unhelpful
If I try and cast the row[0] as? Int or anything else for that matter is always fails.
How does one extract the original type value ?