mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
56 lines
1.8 KiB
Swift
56 lines
1.8 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(_ arguments: inout StatementArguments?) -> String
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
func countedSQL(_ arguments: inout StatementArguments?) -> 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 qualified(by qualifier: SQLTableQualifier) -> Self
|
|
}
|
|
|
|
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
|
///
|
|
/// :nodoc:
|
|
public class SQLTableQualifier {
|
|
private var tableName: String
|
|
private var alias: String?
|
|
|
|
init(tableName: String, alias: String?) {
|
|
self.tableName = tableName
|
|
self.alias = alias
|
|
}
|
|
|
|
var name: String? {
|
|
return alias
|
|
}
|
|
}
|
|
|
|
// 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)
|
|
}
|