JoinAssociation
The JoinAssociation joins common table expression to regular tables or other common table expressions.
struct JoinAssociation<Origin, Destination>The JoinAssociation joins common table expression to regular tables or other common table expressions.
struct JoinAssociation<Origin, Destination>import GRDBA toolkit for SQLite databases, with a focus on application development
var _sqlAssociation: _SQLAssociationtypealias OriginRowDecoder = Origintypealias RowDecoder = Destinationprotocol CopyableA type whose values can be implicitly or explicitly copied.
protocol Escapableprotocol AggregatingRequestA request that can aggregate database rows.
protocol Association : DerivableRequest, SendableA type that defines a connection between two tables.
protocol AssociationToOne : AssociationAn association that defines a to-one connection.
protocol DerivableRequest<RowDecoder> : AggregatingRequest, FilteredRequest, JoinableRequest, OrderedRequest, SelectionRequest, TableRequestDerivableRequest is the base protocol for QueryInterfaceRequest and Association.
protocol FilteredRequestA request that can filter database rows.
protocol JoinableRequest<RowDecoder> : TypedRequestA request that can join and prefetch associations.
protocol OrderedRequestA request that can sort database rows.
protocol SelectionRequestA request that can define the selected columns.
protocol SendableA thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. Values of the type may have no shared mutable state, or they may protect that state with a lock or by forcing it to only be accessed from a specific actor.
protocol TableRequestA request that feeds from a database table
protocol TypedRequest<RowDecoder>A request that knows how to decode database rows.
var databaseTableName: String { get }func _aliased(_ alias: TableAliasBase) -> Self func _including(all association: _SQLAssociation) -> Self func _including(optional association: _SQLAssociation) -> Self func _including(required association: _SQLAssociation) -> Self func _joining(optional association: _SQLAssociation) -> Self func _joining(required association: _SQLAssociation) -> Self func aliased(_ alias: TableAlias<Self.RowDecoder>) -> Self Returns a request that can be referred to with the provided record alias.
func aliased(_ alias: TableAlias<Void>) -> Self Returns a request that can be referred to with the provided anonymous alias.
func all() -> Self Returns self: a request that fetches all rows from this request.
func annotated(with aggregates: [AssociationAggregate<Self.RowDecoder>]) -> Self Appends association aggregates to the selected columns.
func annotated<A>(withOptional association: A) -> Self where A : Association, Self.RowDecoder == A.OriginRowDecoder Appends the columns of the eventual associated record to the selected columns.
func annotated<A>(withRequired association: A) -> Self where A : Association, Self.RowDecoder == A.OriginRowDecoder Appends the columns of the associated record to the selected columns. Records that do not have an associated record are discarded.
func annotatedWhenConnected(with selection: @escaping (Database) throws -> [any SQLSelectable]) -> Self func distinct() -> Self func filter(_ predicate: some SQLSpecificExpressible) -> Self Filters the fetched rows with a boolean SQL expression.
func filter(key: [String : (any DatabaseValueConvertible)?]?) -> Self Filters by primary or unique key.
func filter(keys: [[String : (any DatabaseValueConvertible)?]]) -> Self Filters by primary or unique key.
func filter(literal sqlLiteral: SQL) -> Self Filters the fetched rows with an SQL literal.
func filter(sql: String, arguments: StatementArguments = StatementArguments()) -> Self Filters the fetched rows with an SQL string.
func filterWhenConnected(_ predicate: @escaping (Database) throws -> any SQLExpressible) -> Self func forKey(_ key: String) -> Self func group(_ expressions: [any SQLExpressible]) -> Self Returns an aggregate request grouped on the given SQL expressions.
func group(literal sqlLiteral: SQL) -> Self Returns an aggregate request grouped on an SQL literal.
func group(sql: String, arguments: StatementArguments = StatementArguments()) -> Self Returns an aggregate request grouped on an SQL string.
func groupByPrimaryKey() -> Self Returns an aggregate request grouped on the primary key.
func groupWhenConnected(_ expressions: @escaping (Database) throws -> [any SQLExpressible]) -> Self func having(_ predicate: AssociationAggregate<Self.RowDecoder>) -> Self Filters the fetched records with an association aggregate.
func having(literal sqlLiteral: SQL) -> Self Filters the aggregated groups with an SQL literal.
func having(sql: String, arguments: StatementArguments = StatementArguments()) -> Self Filters the aggregated groups with an SQL string.
func havingWhenConnected(_ predicate: @escaping (Database) throws -> any SQLExpressible) -> Self func including<A>(all association: A) -> Self where A : AssociationToMany, Self.RowDecoder == A.OriginRowDecoder Returns a request that fetches all records associated with each record in this request.
func including<A>(optional association: A) -> Self where A : Association, Self.RowDecoder == A.OriginRowDecoder Returns a request that fetches the eventual record associated with each record of this request.
func including<A>(required association: A) -> Self where A : Association, Self.RowDecoder == A.OriginRowDecoder Returns a request that fetches the record associated with each record in this request. Records that do not have an associated record are discarded.
func joining<A>(optional association: A) -> Self where A : Association, Self.RowDecoder == A.OriginRowDecoder Returns a request that joins each record of this request to its eventual associated record.
func joining<A>(required association: A) -> Self where A : Association, Self.RowDecoder == A.OriginRowDecoder Returns a request that joins each record of this request to its associated record. Records that do not have an associated record are discarded.
func matching(_ pattern: FTS3Pattern?) -> Self Filters rows that match an FTS3 full-text pattern.
func matching(_ pattern: FTS5Pattern?) -> Self Filters rows that match an FTS5 full-text pattern.
func none() -> Self Returns an empty request that fetches no row.
func order(_ orderings: [any SQLOrderingTerm]) -> Self Sorts the fetched rows according to the given SQL ordering terms.
func order(literal sqlLiteral: SQL) -> Self Sorts the fetched rows according to the given SQL literal.
func order(sql: String, arguments: StatementArguments = StatementArguments()) -> Self Sorts the fetched rows according to the given SQL string.
func orderByPrimaryKey() -> Self Sorts the fetched rows according to the primary key.
func orderWhenConnected(_ orderings: @escaping (Database) throws -> [any SQLOrderingTerm]) -> Self func reversed() -> Self func select(_ selection: [any SQLSelectable]) -> Self Defines the result columns.
func select(literal sqlLiteral: SQL) -> Self Defines the result columns with an SQL literal.
func select(sql: String, arguments: StatementArguments = StatementArguments()) -> Self Defines the result columns with an SQL string.
func selectWhenConnected(_ selection: @escaping (Database) throws -> [any SQLSelectable]) -> Self func unordered() -> Self func withStableOrder() -> Self