mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
Add Request.fetchCount(). Implements https://github.com/groue/GRDB.swift/issues/176#issuecomment-282783884
This commit is contained in:
1 parent
fa464b489d
commit
2d2c596f75
5 files changed
+64
-5
No files matched your search
@@ -234,11 +234,12 @@ extension QueryInterfaceRequest {
|
||||
|
||||
// MARK: Counting
|
||||
|
||||
/// The number of rows matched by the request.
|
||||
/// Returns a request that selects the number of rows. Don't call it
|
||||
/// directly: instead, use the `fetchCount` method.
|
||||
///
|
||||
/// - parameter db: A database connection.
|
||||
public func fetchCount(_ db: Database) throws -> Int {
|
||||
return try query.countRequest.fetchOne(db)!
|
||||
public func countRequest(_ db: Database) throws -> AnyTypedRequest<Int> {
|
||||
return try query.countRequest(db)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user