mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Documentation
This commit is contained in:
1 parent
b485d4d3dc
commit
dc16fae72e
2 files changed
+25
No files matched your search
@@ -22,15 +22,29 @@ public protocol _FetchRequest {
|
||||
/// // We know that "SELECT 1 AS a, 2 AS b" selects two columns,
|
||||
/// // so we can find cte columns in the row:
|
||||
/// row.scopes["cte"] // [a:1, b:2]
|
||||
///
|
||||
/// :nodoc:
|
||||
func _selectedColumnCount(_ db: Database) throws -> Int
|
||||
|
||||
/// Returns the request SQL.
|
||||
///
|
||||
/// This method makes it possible to embed a request as a subquery:
|
||||
///
|
||||
/// // SELECT *
|
||||
/// // FROM "player"
|
||||
/// // WHERE "score" = (SELECT MAX("score") FROM "player")
|
||||
/// let maxScore = Player.select(max(Column("score")))
|
||||
/// let players = try Player
|
||||
/// .filter(Column("score") == maxScore)
|
||||
/// .fetchAll(db)
|
||||
///
|
||||
/// - parameter context: An SQL generation context.
|
||||
/// - parameter singleResult: A hint that a single result row will be
|
||||
/// consumed. Implementations can optionally use it to optimize the
|
||||
/// generated SQL, for example by adding a `LIMIT 1` SQL clause.
|
||||
/// - returns: An SQL string.
|
||||
///
|
||||
/// :nodoc:
|
||||
func _requestSQL(_ context: SQLGenerationContext, forSingleResult singleResult: Bool) throws -> String
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// MARK: - SQLCollection
|
||||
|
||||
/// Implementation details of `SQLCollection`.
|
||||
///
|
||||
/// :nodoc:
|
||||
public protocol _SQLCollection {
|
||||
/// Returns a qualified collection.
|
||||
///
|
||||
@@ -8,6 +11,14 @@ public protocol _SQLCollection {
|
||||
|
||||
/// The expressions in the collection, if known.
|
||||
///
|
||||
/// This property makes it possible to track individual rows identified by
|
||||
/// their row ids, and ignore modifications to other rows:
|
||||
///
|
||||
/// // Track rows 1, 2, 3 only
|
||||
/// let request = Player.filter(keys: [1, 2, 3])
|
||||
/// let regionObservation = DatabaseRegionObservation(tracking: request)
|
||||
/// let valueObservation = ValueObservation.tracking(request.fetchAll)
|
||||
///
|
||||
/// :nodoc:
|
||||
var _collectionExpressions: [SQLExpression]? { get }
|
||||
|
||||
|
||||
Reference in new issue
Block a user