I'm using GRDB and a custom struct. Fetching rows works perfectly, however the issue comes when trying to update or delete rows. When I try to add the line to save the record, I get a compiler error that the "variablename" has no member 'save'. The same error appears if I try to delete.
The struct is defined like so:
struct ActiveTraffic {
var id: Int
...
}
extension ActiveTraffic: TableMapping, RowConvertible {
static let databaseTableName = "ActiveTraffic"
enum Columns {
static let id = Column("id")
...
}
init(row: Row) {
id = row[Columns.id]
...
}
}
The class using it is like so:
import GRDB
class CustomManager {
...
try appDBQueue.inTransaction { db in
var activeTraffic = ActiveTraffic(id: traffic.id, ...)
activeTraffic.save(db)
return .commit
}
}
Looking at all of the documentation, it would appear that all I have to do is call .save on the instance to hit the generic implementation of .save or .delete, however it's not recognizing the additional functionality. Any ideas?