Skip to content

Commit 6b23181

Browse files
committed
Use .allColumns and .rowID instead of AllColumns() and Column.rowID
1 parent c5366f4 commit 6b23181

12 files changed

+31
-31
lines changed

Tests/GRDBTests/AssociationBelongsToSQLDerivationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private struct RestrictedB : TableRecord {
2121

2222
private struct ExtendedB : TableRecord {
2323
static let databaseTableName = "b"
24-
static var databaseSelection: [any SQLSelectable] { [AllColumns(), Column.rowID] }
24+
static var databaseSelection: [any SQLSelectable] { [.allColumns, .rowID] }
2525
}
2626

2727
/// Test SQL generation
@@ -76,8 +76,8 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase {
7676
do {
7777
let request = A.including(required: A.b
7878
.select(
79-
AllColumns(),
80-
Column.rowID))
79+
.allColumns,
80+
.rowID))
8181
try assertEqualSQL(db, request, """
8282
SELECT "a".*, "b".*, "b"."rowid" \
8383
FROM "a" \

Tests/GRDBTests/AssociationHasOneSQLDerivationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private struct RestrictedB : TableRecord {
2121

2222
private struct ExtendedB : TableRecord {
2323
static let databaseTableName = "b"
24-
static var databaseSelection: [any SQLSelectable] { [AllColumns(), Column.rowID] }
24+
static var databaseSelection: [any SQLSelectable] { [.allColumns, .rowID] }
2525
}
2626

2727
/// Test SQL generation
@@ -76,8 +76,8 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase {
7676
do {
7777
let request = A.including(required: A.b
7878
.select(
79-
AllColumns(),
80-
Column.rowID))
79+
.allColumns,
80+
.rowID))
8181
try assertEqualSQL(db, request, """
8282
SELECT "a".*, "b".*, "b"."rowid" \
8383
FROM "a" \

Tests/GRDBTests/AssociationHasOneThroughSQLDerivationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private struct RestrictedC : TableRecord {
2424

2525
private struct ExtendedC : TableRecord {
2626
static let databaseTableName = "c"
27-
static var databaseSelection: [any SQLSelectable] { [AllColumns(), Column.rowID] }
27+
static var databaseSelection: [any SQLSelectable] { [.allColumns, .rowID] }
2828
}
2929

3030
/// Test SQL generation
@@ -87,8 +87,8 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase {
8787
do {
8888
let request = A.including(required: A.c
8989
.select(
90-
AllColumns(),
91-
Column.rowID))
90+
.allColumns,
91+
.rowID))
9292
try assertEqualSQL(db, request, """
9393
SELECT "a".*, "c".*, "c"."rowid" \
9494
FROM "a" \

Tests/GRDBTests/DerivableRequestTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ class DerivableRequestTests: GRDBTestCase {
174174
try libraryMigrator.migrate(dbQueue)
175175
try dbQueue.inDatabase { db in
176176
try db.create(view: "authorView", as: Author.select(
177-
AllColumns(),
177+
.allColumns,
178178
[Column("firstName"), Column("lastName")]
179179
.joined(operator: .concat)
180180
.forKey("fullName")))
181-
181+
182182
// ... for one table
183183
clearSQLQueries()
184184
let authorNames = try Author.all()
@@ -221,7 +221,7 @@ class DerivableRequestTests: GRDBTestCase {
221221
XCTAssertEqual(lastSQLQuery, """
222222
SELECT * FROM "author" ORDER BY "id"
223223
""")
224-
224+
225225
clearSQLQueries()
226226
_ /* stableOrderAuthors */ = try Author.all()
227227
.orderByFullName()
@@ -267,7 +267,7 @@ class DerivableRequestTests: GRDBTestCase {
267267
XCTAssertEqual(lastSQLQuery, """
268268
SELECT * FROM "authorView" ORDER BY 1, 2, 3, 4, 5
269269
""")
270-
270+
271271
clearSQLQueries()
272272
_ /* stableOrderAuthorViews */ = try Table("authorView").all()
273273
.order(Column("fullName"))

Tests/GRDBTests/FTS3RecordTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension Book : FetchableRecord {
1919

2020
extension Book : MutablePersistableRecord {
2121
static let databaseTableName = "books"
22-
static var databaseSelection: [any SQLSelectable] { [AllColumns(), Column.rowID] }
22+
static var databaseSelection: [any SQLSelectable] { [.allColumns, .rowID] }
2323

2424
func encode(to container: inout PersistenceContainer) {
2525
container[.rowID] = id

Tests/GRDBTests/FTS4RecordTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension Book : FetchableRecord {
1919

2020
extension Book : MutablePersistableRecord {
2121
static let databaseTableName = "books"
22-
static var databaseSelection: [any SQLSelectable] { [AllColumns(), Column.rowID] }
22+
static var databaseSelection: [any SQLSelectable] { [.allColumns, .rowID] }
2323

2424
func encode(to container: inout PersistenceContainer) {
2525
container[.rowID] = id

Tests/GRDBTests/FTS5RecordTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extension Book : FetchableRecord {
2020

2121
extension Book : MutablePersistableRecord {
2222
static let databaseTableName = "books"
23-
static var databaseSelection: [any SQLSelectable] { [AllColumns(), Column.rowID] }
23+
static var databaseSelection: [any SQLSelectable] { [.allColumns, .rowID] }
2424

2525
func encode(to container: inout PersistenceContainer) {
2626
container[.rowID] = id

Tests/GRDBTests/MutablePersistableRecordTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ extension MutablePersistableRecordTests {
18021802
try dbQueue.inDatabase { db in
18031803
var player = FullPlayer(id: 1, name: "Arthur", score: 1000)
18041804
do {
1805-
_ = try player.updateAndFetch(db, selection: [AllColumns()]) { statement in
1805+
_ = try player.updateAndFetch(db, selection: [.allColumns]) { statement in
18061806
try Row.fetchOne(statement)
18071807
}
18081808
XCTFail("Expected RecordError")
@@ -1813,7 +1813,7 @@ extension MutablePersistableRecordTests {
18131813
player.score = 0
18141814

18151815
do {
1816-
let row = try player.updateAndFetch(db, selection: [AllColumns()]) { statement in
1816+
let row = try player.updateAndFetch(db, selection: [.allColumns]) { statement in
18171817
try Row.fetchOne(statement)
18181818
}
18191819
XCTAssertEqual(row, ["id": 1, "name": "Barbara", "score": 0])
@@ -1856,7 +1856,7 @@ extension MutablePersistableRecordTests {
18561856
try dbQueue.inDatabase { db in
18571857
var player = FullPlayer(id: 1, name: "Arthur", score: 1000)
18581858
do {
1859-
_ = try player.updateAndFetch(db, columns: [Column("score")], selection: [AllColumns()]) { statement in
1859+
_ = try player.updateAndFetch(db, columns: [Column("score")], selection: [.allColumns]) { statement in
18601860
try Row.fetchOne(statement)
18611861
}
18621862
XCTFail("Expected RecordError")
@@ -1867,7 +1867,7 @@ extension MutablePersistableRecordTests {
18671867
player.score = 0
18681868

18691869
do {
1870-
let row = try player.updateAndFetch(db, columns: [Column("score")], selection: [AllColumns()]) { statement in
1870+
let row = try player.updateAndFetch(db, columns: [Column("score")], selection: [.allColumns]) { statement in
18711871
try Row.fetchOne(statement)
18721872
}
18731873
XCTAssertEqual(row, ["id": 1, "name": "Arthur", "score": 0])
@@ -2032,7 +2032,7 @@ extension MutablePersistableRecordTests {
20322032
var player = FullPlayer(id: 1, name: "Arthur", score: 1000)
20332033
do {
20342034
_ = try player.updateChangesAndFetch(
2035-
db, selection: [AllColumns()],
2035+
db, selection: [.allColumns],
20362036
fetch: { statement in try Row.fetchOne(statement) },
20372037
modify: { $0.name = "Barbara" })
20382038
XCTFail("Expected RecordError")
@@ -2043,7 +2043,7 @@ extension MutablePersistableRecordTests {
20432043
do {
20442044
// Update with no change
20452045
let update = try player.updateChangesAndFetch(
2046-
db, selection: [AllColumns()],
2046+
db, selection: [.allColumns],
20472047
fetch: { statement in
20482048
XCTFail("Should not be called")
20492049
return "ignored"
@@ -2054,7 +2054,7 @@ extension MutablePersistableRecordTests {
20542054

20552055
do {
20562056
let updatedRow = try player.updateChangesAndFetch(
2057-
db, selection: [AllColumns()],
2057+
db, selection: [.allColumns],
20582058
fetch: { statement in try Row.fetchOne(statement) },
20592059
modify: { $0.name = "Craig" })
20602060
XCTAssertEqual(updatedRow, ["id": 1, "name": "Craig", "score": 1000])

Tests/GRDBTests/RecordPrimaryKeyHiddenRowIDTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private class Person : Record, Hashable {
2828
// Record
2929

3030
override static var databaseSelection: [any SQLSelectable] {
31-
[AllColumns(), Column.rowID]
31+
[.allColumns, .rowID]
3232
}
3333

3434
override class var databaseTableName: String {

Tests/GRDBTests/SQLLiteralTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ extension SQLLiteralTests {
640640

641641
func testPlusOperatorWithInterpolation() throws {
642642
try makeDatabaseQueue().inDatabase { db in
643-
var query: SQL = "SELECT \(AllColumns()) "
643+
var query: SQL = "SELECT \(.allColumns) "
644644
query = query + "FROM player "
645645
query = query + "WHERE id = \(1)"
646646

@@ -654,7 +654,7 @@ extension SQLLiteralTests {
654654

655655
func testPlusEqualOperatorWithInterpolation() throws {
656656
try makeDatabaseQueue().inDatabase { db in
657-
var query: SQL = "SELECT \(AllColumns()) "
657+
var query: SQL = "SELECT \(.allColumns) "
658658
query += "FROM player "
659659
query += "WHERE id = \(1)"
660660

@@ -668,7 +668,7 @@ extension SQLLiteralTests {
668668

669669
func testAppendLiteralWithInterpolation() throws {
670670
try makeDatabaseQueue().inDatabase { db in
671-
var query: SQL = "SELECT \(AllColumns()) "
671+
var query: SQL = "SELECT \(.allColumns) "
672672
query.append(literal: "FROM player ")
673673
query.append(literal: "WHERE id = \(1)")
674674

@@ -682,7 +682,7 @@ extension SQLLiteralTests {
682682

683683
func testAppendRawSQLWithInterpolation() throws {
684684
try makeDatabaseQueue().inDatabase { db in
685-
var query: SQL = "SELECT \(AllColumns()) "
685+
var query: SQL = "SELECT \(.allColumns) "
686686
query.append(sql: "FROM player ")
687687
query.append(sql: "WHERE score > \(1000) ")
688688
query.append(sql: "AND \("name") = :name", arguments: ["name": "Arthur"])

0 commit comments

Comments
 (0)