mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-22 04:00:39 +00:00
42 lines
1.5 KiB
Swift
42 lines
1.5 KiB
Swift
// MARK: - SQLSelectable
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
///
|
|
/// SQLSelectable is the protocol for types that can be selected, as
|
|
/// described at https://www.sqlite.org/syntax/result-column.html
|
|
///
|
|
/// :nodoc:
|
|
public protocol SQLSelectable {
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
func resultColumnSQL(_ context: inout SQLGenerationContext) -> String
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
func countedSQL(_ context: inout SQLGenerationContext) -> String
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
func count(distinct: Bool) -> SQLCount?
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
func columnCount(_ db: Database) throws -> Int
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
func qualifiedSelectable(with alias: TableAlias) -> SQLSelectable
|
|
}
|
|
|
|
// MARK: - Counting
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
///
|
|
/// :nodoc:
|
|
public enum SQLCount {
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
///
|
|
/// Represents COUNT(*)
|
|
case all
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
///
|
|
/// Represents COUNT(DISTINCT expression)
|
|
case distinct(SQLExpression)
|
|
}
|