File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Sources/StructuredQueriesCore
Tests/StructuredQueriesTests Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ where Base.TableColumns.PrimaryColumn: WritableTableColumnExpression {
252252}
253253
254254extension TableAlias : QueryExpression where Base: QueryExpression {
255- public typealias QueryValue = Base . QueryValue
255+ public typealias QueryValue = Self
256256
257257 public var queryFragment : QueryFragment {
258258 base. queryFragment
Original file line number Diff line number Diff line change @@ -284,6 +284,22 @@ extension SnapshotTests {
284284 """
285285 }
286286 }
287+
288+ @Test func optionalAlias( ) {
289+ let baseQuery =
290+ Reminder
291+ . leftJoin ( RemindersList . as ( RL . self) . all) { $0. remindersListID. eq ( $1. id) }
292+
293+ assertQuery (
294+ baseQuery
295+ . select {
296+ OptionalRemindersListAliasAndReminderCount . Columns (
297+ remindersList: $1,
298+ remindersCount: $0. id. count ( )
299+ )
300+ }
301+ )
302+ }
287303 }
288304}
289305
@@ -313,6 +329,13 @@ struct RemindersListAliasAndReminderCount {
313329 let remindersCount : Int
314330}
315331
332+ @Selection
333+ struct OptionalRemindersListAliasAndReminderCount {
334+ @Columns ( as: TableAlias< RemindersList, RL>? . self )
335+ let remindersList : RemindersList ?
336+ let remindersCount : Int
337+ }
338+
316339@Selection
317340struct Stats {
318341 let completedCount : Int
You can’t perform that action at this time.
0 commit comments