Documentation

This commit is contained in:
Gwendal Roué committed 2019-02-02 17:23:50 +01:00
1 parent 40f6b351ea
commit e62cfe086c
1 file changed
+19
@@ -1,3 +1,22 @@
/// QueryInterfaceRequest is the type of requests generated by TableRecord:
///
/// struct Player: TableRecord { ... }
/// let playerRequest = Player.all() // QueryInterfaceRequest<Player>
///
/// It wraps an SQLSelectQuery, and has an attached type.
///
/// The attached type helps decoding raw database values:
///
/// try dbQueue.read { db in
/// try playerRequest.fetchAll(db) // [Player]
/// try playerRequest.asRequest(of: Row.self).fetchAll(db) // [Row]
/// }
///
/// The attached type also helps the compiler validate associated requests:
///
/// playerRequest.including(required: Player.team) // OK
/// fruitRequest.including(required: Player.team) // Does not compile
/// A QueryInterfaceRequest describes an SQL query.
///
/// See https://github.com/groue/GRDB.swift#the-query-interface