Rename request.exists(_:) to isEmpty(_:)

This commit is contained in:
Gwendal Roué committed 2021-10-17 12:27:19 +02:00
1 parent 55b938a1f5
commit 5f44162abe
4 files changed
+17 -17

No files matched your search

@@ -414,14 +414,14 @@ extension QueryInterfaceRequest {
extension QueryInterfaceRequest {
#warning("TODO: document")
/// Returns whether a row exists in this request.
/// Returns true if the request matches no row in the database.
///
/// try Player.filter(Column("name") == "Arthur").exists(db)
/// try Player.filter(Column("name") == "Arthur").isEmpty(db)
///
/// - parameter db: A database connection.
/// - returns: Whether a row exists in this request
public func exists(_ db: Database) throws -> Bool {
try SQLRequest("SELECT \(exists())").fetchOne(db)!
/// - returns: Whether the request matches no row in the database.
public func isEmpty(_ db: Database) throws -> Bool {
try !SQLRequest("SELECT \(exists())").fetchOne(db)!
}
}