|
57 | 57 | /// ### Changing The Type of Fetched Results |
58 | 58 | /// |
59 | 59 | /// - ``asRequest(of:)`` |
60 | | -/// - ``select(_:as:)-74lsr`` |
| 60 | +/// - ``select(_:as:)-4cj9h`` |
61 | 61 | /// - ``select(literal:as:)`` |
62 | 62 | /// - ``select(sql:arguments:as:)`` |
63 | 63 | /// - ``selectID()`` |
@@ -228,12 +228,12 @@ extension QueryInterfaceRequest: SelectionRequest { |
228 | 228 | /// |
229 | 229 | /// Any previous selection is discarded. |
230 | 230 | public func select<T>( |
231 | | - _ selection: (DatabaseComponents) -> any SQLSelectable, |
232 | | - as type: T.Type = T.self) |
233 | | - -> QueryInterfaceRequest<T> |
| 231 | + _ selection: (DatabaseComponents) throws -> any SQLSelectable, |
| 232 | + as type: T.Type = T.self |
| 233 | + ) rethrows -> QueryInterfaceRequest<T> |
234 | 234 | where RowDecoder: TableRecord |
235 | 235 | { |
236 | | - select(selection).asRequest(of: T.self) |
| 236 | + try select(selection).asRequest(of: T.self) |
237 | 237 | } |
238 | 238 |
|
239 | 239 | /// Defines the result columns with an SQL string, and defines the type of |
@@ -702,8 +702,8 @@ extension QueryInterfaceRequest { |
702 | 702 | /// - precondition: The result of `select` is not empty. |
703 | 703 | public func deleteAndFetchStatement( |
704 | 704 | _ db: Database, |
705 | | - select: (DatabaseComponents) -> [any SQLSelectable]) |
706 | | - throws -> Statement |
| 705 | + select: (DatabaseComponents) throws -> [any SQLSelectable] |
| 706 | + ) throws -> Statement |
707 | 707 | where RowDecoder: TableRecord |
708 | 708 | { |
709 | 709 | try deleteAndFetchStatement(db, selection: select(RowDecoder.databaseComponents)) |
@@ -887,8 +887,8 @@ extension QueryInterfaceRequest { |
887 | 887 | @available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) // SQLite 3.35.0+ |
888 | 888 | public func deleteAndFetchStatement( |
889 | 889 | _ db: Database, |
890 | | - select: (DatabaseComponents) -> [any SQLSelectable]) |
891 | | - throws -> Statement |
| 890 | + select: (DatabaseComponents) throws -> [any SQLSelectable] |
| 891 | + ) throws -> Statement |
892 | 892 | where RowDecoder: TableRecord |
893 | 893 | { |
894 | 894 | try deleteAndFetchStatement(db, selection: select(RowDecoder.databaseComponents)) |
@@ -1059,7 +1059,7 @@ extension QueryInterfaceRequest { |
1059 | 1059 | public func updateAll( |
1060 | 1060 | _ db: Database, |
1061 | 1061 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1062 | | - assignment: (DatabaseComponents) -> ColumnAssignment |
| 1062 | + assignment: (DatabaseComponents) throws -> ColumnAssignment |
1063 | 1063 | ) throws -> Int |
1064 | 1064 | where RowDecoder: TableRecord |
1065 | 1065 | { |
@@ -1094,7 +1094,7 @@ extension QueryInterfaceRequest { |
1094 | 1094 | public func updateAll( |
1095 | 1095 | _ db: Database, |
1096 | 1096 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1097 | | - assignments: (DatabaseComponents) -> [ColumnAssignment] |
| 1097 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment] |
1098 | 1098 | ) throws -> Int |
1099 | 1099 | where RowDecoder: TableRecord |
1100 | 1100 | { |
@@ -1208,9 +1208,9 @@ extension QueryInterfaceRequest { |
1208 | 1208 | public func updateAndFetchStatement( |
1209 | 1209 | _ db: Database, |
1210 | 1210 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1211 | | - assignments: (DatabaseComponents) -> [ColumnAssignment], |
1212 | | - select: (DatabaseComponents) -> [any SQLSelectable]) |
1213 | | - throws -> Statement |
| 1211 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment], |
| 1212 | + select: (DatabaseComponents) -> [any SQLSelectable] |
| 1213 | + ) throws -> Statement |
1214 | 1214 | where RowDecoder: TableRecord |
1215 | 1215 | { |
1216 | 1216 | try updateAndFetchStatement( |
@@ -1303,8 +1303,8 @@ extension QueryInterfaceRequest { |
1303 | 1303 | public func updateAndFetchCursor( |
1304 | 1304 | _ db: Database, |
1305 | 1305 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1306 | | - assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1307 | | - throws -> RecordCursor<RowDecoder> |
| 1306 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment] |
| 1307 | + ) throws -> RecordCursor<RowDecoder> |
1308 | 1308 | where RowDecoder: FetchableRecord & TableRecord |
1309 | 1309 | { |
1310 | 1310 | try updateAndFetchCursor(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
@@ -1382,8 +1382,8 @@ extension QueryInterfaceRequest { |
1382 | 1382 | public func updateAndFetchAll( |
1383 | 1383 | _ db: Database, |
1384 | 1384 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1385 | | - assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1386 | | - throws -> [RowDecoder] |
| 1385 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment] |
| 1386 | + ) throws -> [RowDecoder] |
1387 | 1387 | where RowDecoder: FetchableRecord & TableRecord |
1388 | 1388 | { |
1389 | 1389 | try updateAndFetchAll(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
@@ -1453,8 +1453,8 @@ extension QueryInterfaceRequest { |
1453 | 1453 | public func updateAndFetchSet( |
1454 | 1454 | _ db: Database, |
1455 | 1455 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1456 | | - assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1457 | | - throws -> Set<RowDecoder> |
| 1456 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment] |
| 1457 | + ) throws -> Set<RowDecoder> |
1458 | 1458 | where RowDecoder: FetchableRecord & TableRecord & Hashable |
1459 | 1459 | { |
1460 | 1460 | try updateAndFetchSet(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
@@ -1532,9 +1532,9 @@ extension QueryInterfaceRequest { |
1532 | 1532 | public func updateAndFetchStatement( |
1533 | 1533 | _ db: Database, |
1534 | 1534 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1535 | | - assignments: (DatabaseComponents) -> [ColumnAssignment], |
1536 | | - select: (DatabaseComponents) -> [any SQLSelectable]) |
1537 | | - throws -> Statement |
| 1535 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment], |
| 1536 | + select: (DatabaseComponents) throws -> [any SQLSelectable] |
| 1537 | + ) throws -> Statement |
1538 | 1538 | where RowDecoder: TableRecord |
1539 | 1539 | { |
1540 | 1540 | try updateAndFetchStatement( |
@@ -1629,8 +1629,8 @@ extension QueryInterfaceRequest { |
1629 | 1629 | public func updateAndFetchCursor( |
1630 | 1630 | _ db: Database, |
1631 | 1631 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1632 | | - assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1633 | | - throws -> RecordCursor<RowDecoder> |
| 1632 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment] |
| 1633 | + ) throws -> RecordCursor<RowDecoder> |
1634 | 1634 | where RowDecoder: FetchableRecord & TableRecord |
1635 | 1635 | { |
1636 | 1636 | try updateAndFetchCursor(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
@@ -1710,8 +1710,8 @@ extension QueryInterfaceRequest { |
1710 | 1710 | public func updateAndFetchAll( |
1711 | 1711 | _ db: Database, |
1712 | 1712 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1713 | | - assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1714 | | - throws -> [RowDecoder] |
| 1713 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment] |
| 1714 | + ) throws -> [RowDecoder] |
1715 | 1715 | where RowDecoder: FetchableRecord & TableRecord |
1716 | 1716 | { |
1717 | 1717 | try updateAndFetchAll(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
@@ -1783,8 +1783,8 @@ extension QueryInterfaceRequest { |
1783 | 1783 | public func updateAndFetchSet( |
1784 | 1784 | _ db: Database, |
1785 | 1785 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1786 | | - assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1787 | | - throws -> Set<RowDecoder> |
| 1786 | + assignments: (DatabaseComponents) throws -> [ColumnAssignment] |
| 1787 | + ) throws -> Set<RowDecoder> |
1788 | 1788 | where RowDecoder: FetchableRecord & TableRecord & Hashable |
1789 | 1789 | { |
1790 | 1790 | try updateAndFetchSet(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
|
0 commit comments