mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Add coalesce free function and Row method
This commit is contained in:
1 parent
dc03b8a29e
commit
d7754fa79c
4 files changed
+127
-2
No files matched your search
@@ -71,6 +71,18 @@ public func cast(_ expression: some SQLSpecificExpressible, as storageClass: Dat
|
||||
.cast(expression.sqlExpression, as: storageClass)
|
||||
}
|
||||
|
||||
/// The `COALESCE` SQL function.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// ```swift
|
||||
/// // COALESCE([value1, value2, ...])
|
||||
/// coalesce([Column("value1"), Column("value2"), ...])
|
||||
/// ```
|
||||
public func coalesce(_ values: [some SQLSpecificExpressible]) -> SQLExpression {
|
||||
.function("COALESCE", values.map { $0.sqlExpression })
|
||||
}
|
||||
|
||||
/// The `COUNT` SQL function.
|
||||
///
|
||||
/// For example:
|
||||
|
||||
Reference in new issue
Block a user