exists(_:id:)
Returns whether a record exists for this primary key.
static func exists(_ db: Database, id: ID) throws -> Bool
Parameters
Returns
Whether a record exists for this primary key.
All single-column primary keys are supported:
struct Player: TableRecord, Identifiable {
var id: Int64
}
struct Country: TableRecord, Identifiable {
var id: String
}
try dbQueue.read { db in
let playerExists = try Player.exists(db, id: 1)
let countryExists = try Country.exists(db, id: "FR")
}