mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
Fix SQLRequest inline documentation
This commit is contained in:
1 parent
5defb058d3
commit
95933e93dd
1 file changed
+20
-5
@@ -178,8 +178,12 @@ public struct SQLRequest<T> : FetchRequest {
|
||||
/// Creates a new request from an SQL string, optional arguments, and
|
||||
/// optional row adapter.
|
||||
///
|
||||
/// let request = SQLRequest("SELECT * FROM players")
|
||||
/// let request = SQLRequest("SELECT * FROM players WHERE id = ?", arguments: [1])
|
||||
/// For example:
|
||||
///
|
||||
/// let request = SQLRequest<Player>("SELECT * FROM players WHERE id = ?", arguments: [1])
|
||||
/// try dbQueue.inDatabase { db in
|
||||
/// let player = try request.fetchOne(db) // Player?
|
||||
/// }
|
||||
///
|
||||
/// - parameters:
|
||||
/// - sql: An SQL query.
|
||||
@@ -194,6 +198,17 @@ public struct SQLRequest<T> : FetchRequest {
|
||||
|
||||
/// Creates a new SQL request from any other fetch request.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// let request = Player.filter(Column("name") == "Arthur")
|
||||
/// try dbQueue.inDatabase { db in
|
||||
/// let sqlRequest = try SQLRequest(db, request: request) // SQLRequest<Player>
|
||||
/// print(sqlRequest.sql)
|
||||
/// // Prints "SELECT * FROM players WHERE name = ?"
|
||||
/// print(sqlRequest.arguments)
|
||||
/// // Prints ["Arthur"]
|
||||
/// }
|
||||
///
|
||||
/// - parameters:
|
||||
/// - db: A database connection.
|
||||
/// - request: A request.
|
||||
@@ -208,14 +223,14 @@ public struct SQLRequest<T> : FetchRequest {
|
||||
/// Creates a new SQL request from an SQL string, optional arguments, and
|
||||
/// optional row adapter.
|
||||
///
|
||||
/// let request = SQLRequest("SELECT * FROM players")
|
||||
/// let request = SQLRequest("SELECT * FROM players WHERE id = ?", arguments: [1])
|
||||
/// The *cache* arguments should be `.internal` for requests generated by
|
||||
/// GRDB, and `.public` for requests generated by the user.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - sql: An SQL query.
|
||||
/// - arguments: Optional statement arguments.
|
||||
/// - adapter: Optional RowAdapter.
|
||||
/// - statementCacheName: Optional statement cache name.
|
||||
/// - cache: Optional statement cache name.
|
||||
/// - returns: A SQLRequest
|
||||
init(_ sql: String, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil, fromCache cache: Cache?) {
|
||||
self.sql = sql
|
||||
|
||||
Reference in new issue
Block a user