AdaptedFetchRequest
An adapted request.
struct AdaptedFetchRequest<Base> where Base : FetchRequest
See adapted(_:)
.
An adapted request.
struct AdaptedFetchRequest<Base> where Base : FetchRequest
See adapted(_:)
.
import GRDB
A toolkit for SQLite databases, with a focus on application development
protocol FetchRequest<RowDecoder> : DatabaseRegionConvertible, SQLSubqueryable
A type that fetches and decodes database rows.
func adapted(_ adapter: @escaping (Database) throws -> any RowAdapter) -> AdaptedFetchRequest<Self>
Returns an adapted request.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol DatabaseRegionConvertible : Sendable
A type that operates on a specific DatabaseRegion
.
protocol Escapable
protocol SQLExpressible
A type that can be used as an SQL expression.
protocol SQLOrderingTerm
A type that can be used as an SQL ordering term.
protocol SQLSelectable
A type that can be used as SQL result columns.
protocol SQLSpecificExpressible : SQLExpressible, SQLOrderingTerm, SQLSelectable
A database-specific type that can be used as an SQL expression.
protocol SQLSubqueryable : SQLSpecificExpressible
A type that can be used as SQL subquery.
protocol Sendable
var sqlSubquery: SQLSubquery { get }
func fetchCount(_ db: Database) throws -> Int
func makePreparedRequest(_ db: Database, forSingleResult singleResult: Bool = false) throws -> PreparedRequest
typealias RowDecoder = Base.RowDecoder
var asJSON: AnySQLJSONExpressible { get }
Returns an expression that is interpreted as a JSON value.
var asc: SQLOrdering { get }
An ordering term for ascending order (nulls first).
var ascNullsLast: SQLOrdering { get }
An ordering term for ascending order (nulls last).
var capitalized: SQLExpression { get }
An SQL expression that calls the Foundation String.capitalized
property.
var desc: SQLOrdering { get }
An ordering term for descending order (nulls last).
var descNullsFirst: SQLOrdering { get }
An ordering term for descending order (nulls first).
var localizedCapitalized: SQLExpression { get }
An SQL expression that calls the Foundation String.localizedCapitalized
property.
var localizedLowercased: SQLExpression { get }
An SQL expression that calls the Foundation String.localizedLowercase
property.
var localizedUppercased: SQLExpression { get }
An SQL expression that calls the Foundation String.localizedUppercase
property.
var lowercased: SQLExpression { get }
An SQL expression that calls the Swift String.lowercased()
method.
var sqlExpression: SQLExpression { get }
Returns a subquery expression.
var sqlOrdering: SQLOrdering { get }
var sqlSelection: SQLSelection { get }
var uppercased: SQLExpression { get }
An SQL expression that calls the Swift String.uppercased()
method.
static func ! (value: Self) -> SQLExpression
A negated logical SQL expression.
static func != (lhs: (any SQLExpressible)?, rhs: Self) -> SQLExpression
Compares two SQL expressions.
static func != (lhs: Bool, rhs: Self) -> SQLExpression
The <>
SQL operator.
static func != (lhs: Self, rhs: (any SQLExpressible)?) -> SQLExpression
Compares two SQL expressions.
static func != (lhs: Self, rhs: Bool) -> SQLExpression
The <>
SQL operator.
static func != (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The <>
SQL operator.
static func !== (lhs: (any SQLExpressible)?, rhs: Self) -> SQLExpression
The IS NOT
SQL operator.
static func !== (lhs: Self, rhs: (any SQLExpressible)?) -> SQLExpression
The IS NOT
SQL operator.
static func !== (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The IS NOT
SQL operator.
static func && (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The AND
SQL operator.
static func && (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The AND
SQL operator.
static func && (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The AND
SQL operator.
static func & (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The &
SQL operator.
static func & (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The &
SQL operator.
static func & (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The &
SQL operator.
static func * (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The *
SQL operator.
static func * (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The *
SQL operator.
static func * (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The *
SQL operator.
static func + (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The +
SQL operator.
static func + (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The +
SQL operator.
static func + (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The +
SQL operator.
static func - (value: Self) -> SQLExpression
The -
SQL operator.
static func - (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The -
SQL operator.
static func - (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The -
SQL operator.
static func - (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The -
SQL operator.
static func / (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The /
SQL operator.
static func / (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The /
SQL operator.
static func / (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The /
SQL operator.
static func < (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The <
SQL operator.
static func < (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The <
SQL operator.
static func < (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The <
SQL operator.
static func << (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The <<
SQL operator.
static func << (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The <<
SQL operator.
static func << (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The <<
SQL operator.
static func <= (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The <=
SQL operator.
static func <= (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The <=
SQL operator.
static func <= (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The <=
SQL operator.
static func == (lhs: (any SQLExpressible)?, rhs: Self) -> SQLExpression
Compares two SQL expressions.
static func == (lhs: Bool, rhs: Self) -> SQLExpression
The =
SQL operator.
static func == (lhs: Self, rhs: (any SQLExpressible)?) -> SQLExpression
Compares two SQL expressions.
static func == (lhs: Self, rhs: Bool) -> SQLExpression
The =
SQL operator.
static func == (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The =
SQL operator.
static func === (lhs: (any SQLExpressible)?, rhs: Self) -> SQLExpression
The IS
SQL operator.
static func === (lhs: Self, rhs: (any SQLExpressible)?) -> SQLExpression
The IS
SQL operator.
static func === (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The IS
SQL operator.
static func > (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The >
SQL operator.
static func > (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The >
SQL operator.
static func > (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The >
SQL operator.
static func >= (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The >=
SQL operator.
static func >= (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The >=
SQL operator.
static func >= (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The >=
SQL operator.
static func >> (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The >>
SQL operator.
static func >> (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The >>
SQL operator.
static func >> (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The >>
SQL operator.
static func ?? (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The IFNULL
SQL function.
static func | (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The |
SQL operator.
static func | (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The |
SQL operator.
static func | (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The |
SQL operator.
static func || (lhs: some SQLExpressible, rhs: Self) -> SQLExpression
The OR
SQL operator.
static func || (lhs: Self, rhs: some SQLExpressible) -> SQLExpression
The OR
SQL operator.
static func || (lhs: Self, rhs: some SQLSpecificExpressible) -> SQLExpression
The OR
SQL operator.
static func ~ (value: Self) -> SQLExpression
The ~
SQL operator.
func collating(_ collation: DatabaseCollation) -> SQLExpression
Returns a collated expression.
func collating(_ collation: Database.CollationName) -> SQLExpression
Returns a collated expression.
func contains(_ element: some SQLExpressible) -> SQLExpression
Returns an expression that checks the inclusion of the expression in the subquery.
func databaseRegion(_ db: Database) throws -> DatabaseRegion
Returns the database region that the request feeds from.
func exists() -> SQLExpression
Returns an expression that is true if and only if the subquery would return one or more rows.
func fetchAll(_ db: Database) throws -> [RowDecoder]
Returns an array of fetched records.
func fetchAll(_ db: Database) throws -> [RowDecoder]
Returns an array of fetched values.
func fetchAll(_ db: Database) throws -> [RowDecoder]
Returns an array of fetched values.
func fetchAll(_ db: Database) throws -> [Row]
Returns an array of fetched rows.
func fetchCursor(_ db: Database) throws -> RecordCursor<RowDecoder>
Returns a cursor over fetched records.
func fetchCursor(_ db: Database) throws -> FastDatabaseValueCursor<RowDecoder>
Returns a cursor over fetched values.
func fetchCursor(_ db: Database) throws -> DatabaseValueCursor<RowDecoder>
Returns a cursor over fetched values.
func fetchCursor(_ db: Database) throws -> RowCursor
Returns a cursor over fetched rows.
func fetchOne(_ db: Database) throws -> RowDecoder?
Returns a single record.
func fetchOne(_ db: Database) throws -> RowDecoder?
Returns a single fetched value.
func fetchOne(_ db: Database) throws -> RowDecoder?
Returns a single fetched value.
func fetchOne(_ db: Database) throws -> Row?
Returns a single row.
func fetchSet(_ db: Database) throws -> Set<RowDecoder>
Returns a set of fetched records.
func fetchSet(_ db: Database) throws -> Set<RowDecoder>
Returns a set of fetched values.
func fetchSet(_ db: Database) throws -> Set<RowDecoder>
Returns a set of fetched values.
func fetchSet(_ db: Database) throws -> Set<Row>
Returns a set of fetched rows.
func forKey(_ key: String) -> SQLSelection
Returns an aliased result column.
func like(_ pattern: some SQLExpressible, escape: (any SQLExpressible)? = nil) -> SQLExpression
The LIKE
SQL operator.