Skip to content

Commit 9bbfc44

Browse files
authored
Conditionally conform optional to selection (#204)
* Conditionally conform optional to selection * wip
1 parent dcf489f commit 9bbfc44

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

Sources/StructuredQueriesCore/Never.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ extension Never: Table {
2525

2626
private struct NotDecodable: Error {}
2727
}
28+
29+
extension Never: _Selection {}

Sources/StructuredQueriesCore/Optional.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ extension Optional: Table, PartialSelectStatement, Statement where Wrapped: Tabl
183183
public typealias Selection = Wrapped.Selection?
184184
}
185185

186+
extension Optional: _Selection where Wrapped: _Selection {}
187+
186188
extension Optional: PrimaryKeyedTable where Wrapped: PrimaryKeyedTable {
187189
public typealias Draft = Wrapped.Draft?
188190
}

Sources/StructuredQueriesCore/TableAlias.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ public struct TableAlias<
183183
}
184184
}
185185

186+
extension TableAlias: _Selection where Base: _Selection {}
187+
186188
extension TableAlias: PrimaryKeyedTable where Base: PrimaryKeyedTable {
187189
public typealias Draft = TableAlias<Base.Draft, Name>
188190
}

0 commit comments

Comments
 (0)