mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Introduce DatabaseCursor (addresses #147)
let cursor = try Row.fetchCursor(db, "SELECT * FROM persons)
while let row = try cursor.step() { ... }
This commit is contained in:
1 parent
adc4ae48d6
commit
b9fea2ea12
8 files changed
+222
-44
No files matched your search
@@ -30,6 +30,11 @@ extension QueryInterfaceRequest where T: RowConvertible {
|
||||
|
||||
// MARK: Fetching Record and RowConvertible
|
||||
|
||||
/// TODO
|
||||
public func fetchCursor(_ db: Database) throws -> DatabaseCursor<T> {
|
||||
return try T.fetchCursor(db, self)
|
||||
}
|
||||
|
||||
/// A sequence of fetched records.
|
||||
///
|
||||
/// let nameColumn = Column("name")
|
||||
@@ -483,6 +488,11 @@ extension RowConvertible where Self: TableMapping {
|
||||
|
||||
// MARK: Fetching All
|
||||
|
||||
/// TODO
|
||||
public static func fetchCursor(_ db: Database) throws -> DatabaseCursor<Self> {
|
||||
return try all().fetchCursor(db)
|
||||
}
|
||||
|
||||
/// A sequence of all records fetched from the database.
|
||||
///
|
||||
/// let persons = Person.fetch(db) // DatabaseSequence<Person>
|
||||
|
||||
Reference in new issue
Block a user