SQLSpecificExpressible
A database-specific type that can be used as an SQL expression.
protocol SQLSpecificExpressible : SQLExpressible, SQLOrderingTerm, SQLSelectable
Browse conforming typesSQLSpecificExpressible
is the protocol for all database-specific types that can be turned into an SQL expression. Types whose existence is not purely dedicated to the database should adopt the SQLExpressible
protocol instead.
For example, Column
is a type that only exists to help you build requests, and it adopts SQLSpecificExpressible
.
On the other side, Int
adopts SQLExpressible
.
Applying a Collation
func collating(Database.CollationName
) -> SQLExpression Returns a collated expression.
func collating(DatabaseCollation
) -> SQLExpression Returns a collated expression.
SQL Functions & Operators
See also JSON functions in JSON Support.
func abs(some SQLSpecificExpressible
) -> SQLExpression The
ABS
SQL function.func average(some SQLSpecificExpressible
) -> SQLExpression The
AVG
SQL function.func average(some SQLSpecificExpressible, filter: some SQLSpecificExpressible
) -> SQLExpression The
AVG
SQL function.var capitalized: SQLExpression
An SQL expression that calls the Foundation
String.capitalized
property.func cast(some SQLSpecificExpressible, as: Database.StorageClass
) -> SQLExpression The
CAST
SQL function.func coalesce(some Collection<any SQLSpecificExpressible>
) -> SQLExpression The
COALESCE
SQL function.func count(some SQLSpecificExpressible
) -> SQLExpression The
COUNT
SQL function.func count(distinct: some SQLSpecificExpressible
) -> SQLExpression The
COUNT(DISTINCT)
SQL function.func dateTime(some SQLSpecificExpressible, SQLDateModifier...
) -> SQLExpression The
DATETIME
SQL function.func julianDay(some SQLSpecificExpressible, SQLDateModifier...
) -> SQLExpression The
JULIANDAY
SQL function.func length(some SQLSpecificExpressible
) -> SQLExpression The
LENGTH
SQL function.func like(some SQLExpressible, escape: (any SQLExpressible)?
) -> SQLExpression The
LIKE
SQL operator.var localizedCapitalized: SQLExpression
An SQL expression that calls the Foundation
String.localizedCapitalized
property.var localizedLowercased: SQLExpression
An SQL expression that calls the Foundation
String.localizedLowercase
property.var localizedUppercased: SQLExpression
An SQL expression that calls the Foundation
String.localizedUppercase
property.var lowercased: SQLExpression
An SQL expression that calls the Swift
String.lowercased()
method.func min(some SQLSpecificExpressible
) -> SQLExpression The
MIN
SQL function.func min(some SQLSpecificExpressible, filter: some SQLSpecificExpressible
) -> SQLExpression The
MIN
SQL function.func max(some SQLSpecificExpressible
) -> SQLExpression The
MAX
SQL function.func max(some SQLSpecificExpressible, filter: some SQLSpecificExpressible
) -> SQLExpression The
MAX
SQL function.func sum(some SQLSpecificExpressible
) -> SQLExpression The
SUM
SQL function.func sum(some SQLSpecificExpressible, filter: some SQLSpecificExpressible
) -> SQLExpression The
SUM
SQL function.func total(some SQLSpecificExpressible
) -> SQLExpression The
TOTAL
SQL function.func total(some SQLSpecificExpressible, filter: some SQLSpecificExpressible
) -> SQLExpression The
TOTAL
SQL function.var uppercased: SQLExpression
An SQL expression that calls the Swift
String.uppercased()
method.enum SQLDateModifier
A date modifier for SQLite date functions.
Interpreting an expression as JSON
var asJSON: AnySQLJSONExpressible
Returns an expression that is interpreted as a JSON value.
Creating Ordering Terms
var asc: SQLOrdering
An ordering term for ascending order (nulls first).
var ascNullsLast: SQLOrdering
An ordering term for ascending order (nulls last).
var desc: SQLOrdering
An ordering term for descending order (nulls last).
var descNullsFirst: SQLOrdering
An ordering term for descending order (nulls first).
Creating Result Columns
func forKey(String
) -> SQLSelection Returns an aliased result column.
func forKey(some CodingKey
) -> SQLSelection Returns an aliased column with the same name as the coding key.