|
57 | 57 | /// ### Changing The Type of Fetched Results |
58 | 58 | /// |
59 | 59 | /// - ``asRequest(of:)`` |
60 | | -/// - ``select(_:as:)-58954`` |
| 60 | +/// - ``select(_:as:)-74lsr`` |
61 | 61 | /// - ``select(literal:as:)`` |
62 | 62 | /// - ``select(sql:arguments:as:)`` |
63 | 63 | /// - ``selectID()`` |
@@ -228,7 +228,7 @@ extension QueryInterfaceRequest: SelectionRequest { |
228 | 228 | /// |
229 | 229 | /// Any previous selection is discarded. |
230 | 230 | public func select<T>( |
231 | | - _ selection: (RowDecoder.ColumnsProvider) -> any SQLSelectable, |
| 231 | + _ selection: (DatabaseComponents) -> any SQLSelectable, |
232 | 232 | as type: T.Type = T.self) |
233 | 233 | -> QueryInterfaceRequest<T> |
234 | 234 | where RowDecoder: TableRecord |
@@ -591,6 +591,10 @@ extension QueryInterfaceRequest { |
591 | 591 | } |
592 | 592 | } |
593 | 593 |
|
| 594 | +extension QueryInterfaceRequest where RowDecoder: TableRecord { |
| 595 | + public typealias DatabaseComponents = RowDecoder.DatabaseComponents |
| 596 | +} |
| 597 | + |
594 | 598 | // MARK: - Check Existence |
595 | 599 |
|
596 | 600 | extension QueryInterfaceRequest { |
@@ -698,11 +702,11 @@ extension QueryInterfaceRequest { |
698 | 702 | /// - precondition: The result of `select` is not empty. |
699 | 703 | public func deleteAndFetchStatement( |
700 | 704 | _ db: Database, |
701 | | - select: (RowDecoder.ColumnsProvider) -> [any SQLSelectable]) |
| 705 | + select: (DatabaseComponents) -> [any SQLSelectable]) |
702 | 706 | throws -> Statement |
703 | 707 | where RowDecoder: TableRecord |
704 | 708 | { |
705 | | - try deleteAndFetchStatement(db, selection: select(RowDecoder.columns)) |
| 709 | + try deleteAndFetchStatement(db, selection: select(RowDecoder.databaseComponents)) |
706 | 710 | } |
707 | 711 |
|
708 | 712 | /// Returns a cursor over the records deleted by a |
@@ -883,11 +887,11 @@ extension QueryInterfaceRequest { |
883 | 887 | @available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) // SQLite 3.35.0+ |
884 | 888 | public func deleteAndFetchStatement( |
885 | 889 | _ db: Database, |
886 | | - select: (RowDecoder.ColumnsProvider) -> [any SQLSelectable]) |
| 890 | + select: (DatabaseComponents) -> [any SQLSelectable]) |
887 | 891 | throws -> Statement |
888 | 892 | where RowDecoder: TableRecord |
889 | 893 | { |
890 | | - try deleteAndFetchStatement(db, selection: select(RowDecoder.columns)) |
| 894 | + try deleteAndFetchStatement(db, selection: select(RowDecoder.databaseComponents)) |
891 | 895 | } |
892 | 896 |
|
893 | 897 | /// Returns a cursor over the records deleted by a |
@@ -1055,11 +1059,11 @@ extension QueryInterfaceRequest { |
1055 | 1059 | public func updateAll( |
1056 | 1060 | _ db: Database, |
1057 | 1061 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1058 | | - assignment: (RowDecoder.ColumnsProvider) -> ColumnAssignment |
| 1062 | + assignment: (DatabaseComponents) -> ColumnAssignment |
1059 | 1063 | ) throws -> Int |
1060 | 1064 | where RowDecoder: TableRecord |
1061 | 1065 | { |
1062 | | - try updateAll(db, onConflict: conflictResolution, [assignment(RowDecoder.columns)]) |
| 1066 | + try updateAll(db, onConflict: conflictResolution, [assignment(RowDecoder.databaseComponents)]) |
1063 | 1067 | } |
1064 | 1068 |
|
1065 | 1069 | /// Updates matching rows, and returns the number of updated rows. |
@@ -1090,11 +1094,11 @@ extension QueryInterfaceRequest { |
1090 | 1094 | public func updateAll( |
1091 | 1095 | _ db: Database, |
1092 | 1096 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1093 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment] |
| 1097 | + assignments: (DatabaseComponents) -> [ColumnAssignment] |
1094 | 1098 | ) throws -> Int |
1095 | 1099 | where RowDecoder: TableRecord |
1096 | 1100 | { |
1097 | | - try updateAll(db, onConflict: conflictResolution, assignments(RowDecoder.columns)) |
| 1101 | + try updateAll(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
1098 | 1102 | } |
1099 | 1103 |
|
1100 | 1104 | /// Updates matching rows, and returns the number of updated rows. |
@@ -1204,16 +1208,16 @@ extension QueryInterfaceRequest { |
1204 | 1208 | public func updateAndFetchStatement( |
1205 | 1209 | _ db: Database, |
1206 | 1210 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1207 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment], |
1208 | | - select: (RowDecoder.ColumnsProvider) -> [any SQLSelectable]) |
| 1211 | + assignments: (DatabaseComponents) -> [ColumnAssignment], |
| 1212 | + select: (DatabaseComponents) -> [any SQLSelectable]) |
1209 | 1213 | throws -> Statement |
1210 | 1214 | where RowDecoder: TableRecord |
1211 | 1215 | { |
1212 | 1216 | try updateAndFetchStatement( |
1213 | 1217 | db, |
1214 | 1218 | onConflict: conflictResolution, |
1215 | | - assignments(RowDecoder.columns), |
1216 | | - selection: select(RowDecoder.columns)) |
| 1219 | + assignments(RowDecoder.databaseComponents), |
| 1220 | + selection: select(RowDecoder.databaseComponents)) |
1217 | 1221 | } |
1218 | 1222 |
|
1219 | 1223 | /// Returns an `UPDATE RETURNING` prepared statement. |
@@ -1299,11 +1303,11 @@ extension QueryInterfaceRequest { |
1299 | 1303 | public func updateAndFetchCursor( |
1300 | 1304 | _ db: Database, |
1301 | 1305 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1302 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment]) |
| 1306 | + assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1303 | 1307 | throws -> RecordCursor<RowDecoder> |
1304 | 1308 | where RowDecoder: FetchableRecord & TableRecord |
1305 | 1309 | { |
1306 | | - try updateAndFetchCursor(db, onConflict: conflictResolution, assignments(RowDecoder.columns)) |
| 1310 | + try updateAndFetchCursor(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
1307 | 1311 | } |
1308 | 1312 |
|
1309 | 1313 | /// Returns a cursor over the records updated by an |
@@ -1378,11 +1382,11 @@ extension QueryInterfaceRequest { |
1378 | 1382 | public func updateAndFetchAll( |
1379 | 1383 | _ db: Database, |
1380 | 1384 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1381 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment]) |
| 1385 | + assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1382 | 1386 | throws -> [RowDecoder] |
1383 | 1387 | where RowDecoder: FetchableRecord & TableRecord |
1384 | 1388 | { |
1385 | | - try updateAndFetchAll(db, onConflict: conflictResolution, assignments(RowDecoder.columns)) |
| 1389 | + try updateAndFetchAll(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
1386 | 1390 | } |
1387 | 1391 |
|
1388 | 1392 | /// Execute an `UPDATE RETURNING` statement and returns the array of |
@@ -1449,11 +1453,11 @@ extension QueryInterfaceRequest { |
1449 | 1453 | public func updateAndFetchSet( |
1450 | 1454 | _ db: Database, |
1451 | 1455 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1452 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment]) |
| 1456 | + assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1453 | 1457 | throws -> Set<RowDecoder> |
1454 | 1458 | where RowDecoder: FetchableRecord & TableRecord & Hashable |
1455 | 1459 | { |
1456 | | - try updateAndFetchSet(db, onConflict: conflictResolution, assignments(RowDecoder.columns)) |
| 1460 | + try updateAndFetchSet(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
1457 | 1461 | } |
1458 | 1462 |
|
1459 | 1463 | /// Execute an `UPDATE RETURNING` statement and returns the set of |
@@ -1528,16 +1532,16 @@ extension QueryInterfaceRequest { |
1528 | 1532 | public func updateAndFetchStatement( |
1529 | 1533 | _ db: Database, |
1530 | 1534 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1531 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment], |
1532 | | - select: (RowDecoder.ColumnsProvider) -> [any SQLSelectable]) |
| 1535 | + assignments: (DatabaseComponents) -> [ColumnAssignment], |
| 1536 | + select: (DatabaseComponents) -> [any SQLSelectable]) |
1533 | 1537 | throws -> Statement |
1534 | 1538 | where RowDecoder: TableRecord |
1535 | 1539 | { |
1536 | 1540 | try updateAndFetchStatement( |
1537 | 1541 | db, |
1538 | 1542 | onConflict: conflictResolution, |
1539 | | - assignments(RowDecoder.columns), |
1540 | | - selection: select(RowDecoder.columns)) |
| 1543 | + assignments(RowDecoder.databaseComponents), |
| 1544 | + selection: select(RowDecoder.databaseComponents)) |
1541 | 1545 | } |
1542 | 1546 |
|
1543 | 1547 | /// Returns an `UPDATE RETURNING` prepared statement. |
@@ -1625,11 +1629,11 @@ extension QueryInterfaceRequest { |
1625 | 1629 | public func updateAndFetchCursor( |
1626 | 1630 | _ db: Database, |
1627 | 1631 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1628 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment]) |
| 1632 | + assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1629 | 1633 | throws -> RecordCursor<RowDecoder> |
1630 | 1634 | where RowDecoder: FetchableRecord & TableRecord |
1631 | 1635 | { |
1632 | | - try updateAndFetchCursor(db, onConflict: conflictResolution, assignments(RowDecoder.columns)) |
| 1636 | + try updateAndFetchCursor(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
1633 | 1637 | } |
1634 | 1638 |
|
1635 | 1639 | /// Returns a cursor over the records updated by an |
@@ -1706,11 +1710,11 @@ extension QueryInterfaceRequest { |
1706 | 1710 | public func updateAndFetchAll( |
1707 | 1711 | _ db: Database, |
1708 | 1712 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1709 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment]) |
| 1713 | + assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1710 | 1714 | throws -> [RowDecoder] |
1711 | 1715 | where RowDecoder: FetchableRecord & TableRecord |
1712 | 1716 | { |
1713 | | - try updateAndFetchAll(db, onConflict: conflictResolution, assignments(RowDecoder.columns)) |
| 1717 | + try updateAndFetchAll(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
1714 | 1718 | } |
1715 | 1719 |
|
1716 | 1720 | /// Execute an `UPDATE RETURNING` statement and returns the array of |
@@ -1779,11 +1783,11 @@ extension QueryInterfaceRequest { |
1779 | 1783 | public func updateAndFetchSet( |
1780 | 1784 | _ db: Database, |
1781 | 1785 | onConflict conflictResolution: Database.ConflictResolution? = nil, |
1782 | | - assignments: (RowDecoder.ColumnsProvider) -> [ColumnAssignment]) |
| 1786 | + assignments: (DatabaseComponents) -> [ColumnAssignment]) |
1783 | 1787 | throws -> Set<RowDecoder> |
1784 | 1788 | where RowDecoder: FetchableRecord & TableRecord & Hashable |
1785 | 1789 | { |
1786 | | - try updateAndFetchSet(db, onConflict: conflictResolution, assignments(RowDecoder.columns)) |
| 1790 | + try updateAndFetchSet(db, onConflict: conflictResolution, assignments(RowDecoder.databaseComponents)) |
1787 | 1791 | } |
1788 | 1792 |
|
1789 | 1793 | /// Execute an `UPDATE RETURNING` statement and returns the set of |
|
0 commit comments