Skip to content

Commit 91c30af

Browse files
committed
format
1 parent 25e9385 commit 91c30af

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

Sources/SQLite/Typed/Query.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,22 +1160,22 @@ public struct Row {
11601160

11611161
let columnNames: [String: Int]
11621162

1163-
fileprivate let values: any CursorProtocol
1163+
fileprivate let values: any CursorProtocol
11641164

11651165
init(_ columnNames: [String: Int], _ values: some CursorProtocol) {
11661166
self.columnNames = columnNames
11671167
self.values = values
11681168
}
11691169

1170-
init(_ columnNames: [String: Int], _ values: [Binding?]) {
1171-
self.init(columnNames, CursorWithBindingArray(elements: values))
1172-
}
1170+
init(_ columnNames: [String: Int], _ values: [Binding?]) {
1171+
self.init(columnNames, CursorWithBindingArray(elements: values))
1172+
}
11731173

11741174
func hasValue(for column: String) -> Bool {
11751175
guard let idx = columnNames[column.quote()] else {
11761176
return false
11771177
}
1178-
return (try? values.getValue(idx)) != nil
1178+
return (try? values.getValue(idx)) != nil
11791179
}
11801180

11811181
/// Returns a row’s value for the given column.

Tests/SQLiteTests/Core/Connection+AttachTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ConnectionAttachTests: SQLiteTestCase {
2828
_ = try db.run(table.insert(name <- "test"))
2929

3030
// query data
31-
let rows: [_] = try db.prepare(table.select(name)).map { $0[name] }
31+
let rows: [_] = try db.prepare(table.select(name)).map { $0[name] }
3232
XCTAssertEqual(["test"], rows)
3333

3434
try db.detach(schemaName)

Tests/SQLiteTests/Core/ConnectionTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class ConnectionTests: SQLiteTestCase {
175175
try backup.step()
176176

177177
let users = try target.prepare("SELECT email FROM users ORDER BY email")
178-
XCTAssertEqual(users.map { $0.getValue(0) as String? }, ["alice@example.com", "betsy@example.com"])
178+
XCTAssertEqual(users.map { $0.getValue(0) as String? }, ["alice@example.com", "betsy@example.com"])
179179
}
180180

181181
func test_transaction_beginsAndCommitsTransactions() throws {

Tests/SQLiteTests/Extensions/FTSIntegrationTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ class FTSIntegrationTests: SQLiteTestCase {
5454
XCTAssertEqual(matches.map { $0[email ]}, ["Paul@example.com"])
5555
}
5656

57-
func testAny() throws {
58-
try createIndex()
59-
let match = try db.prepare(index.match("Paul")).last
60-
XCTAssertEqual(match?[email], "Paul@example.com")
61-
}
57+
func testAny() throws {
58+
try createIndex()
59+
let match = try db.prepare(index.match("Paul")).last
60+
XCTAssertEqual(match?[email], "Paul@example.com")
61+
}
6262

6363
func testMatchPartial() throws {
6464
try insertUsers("Paula")
@@ -69,7 +69,7 @@ class FTSIntegrationTests: SQLiteTestCase {
6969

7070
func testTrigramIndex() throws {
7171
try createTrigramIndex()
72-
let matches: [_] = try db.prepare(index.match("Paul"))
72+
let matches: [_] = try db.prepare(index.match("Paul"))
7373
XCTAssertEqual(1, matches.count)
7474
}
7575

Tests/SQLiteTests/Typed/QueryIntegrationTests.swift

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class QueryIntegrationTests: SQLiteTestCase {
4949
let names = ["a", "b", "c"]
5050
try insertUsers(names)
5151

52-
let emails = try db.prepare("select email from users", []).compactMap { try? $0.getValue(0) as String }
52+
let emails = try db.prepare("select email from users", []).compactMap { try? $0.getValue(0) as String }
5353

5454
XCTAssertEqual(names.map({ "\($0)@example.com" }), emails.sorted())
5555
}
@@ -213,7 +213,7 @@ class QueryIntegrationTests: SQLiteTestCase {
213213
let query1 = users.filter(email == "alice@example.com")
214214
let query2 = users.filter(email == "sally@example.com")
215215

216-
let actualIDs: [_] = try db.prepare(query1.union(query2)).map { $0[self.id] }
216+
let actualIDs: [_] = try db.prepare(query1.union(query2)).map { $0[self.id] }
217217
XCTAssertEqual(expectedIDs,actualIDs)
218218

219219
let query3 = users.select(users[*], SQLite.Expression<Int>(literal: "1 AS weight")).filter(email == "sally@example.com")
@@ -226,7 +226,7 @@ class QueryIntegrationTests: SQLiteTestCase {
226226
SELECT "users".*, 2 AS weight FROM "users" WHERE ("email" = 'alice@example.com') ORDER BY weight
227227
""")
228228

229-
let orderedIDs: [_] = try db.prepare(query3.union(query4).order(SQLite.Expression<Int>(literal: "weight"), email)).map { $0[self.id] }
229+
let orderedIDs: [_] = try db.prepare(query3.union(query4).order(SQLite.Expression<Int>(literal: "weight"), email)).map { $0[self.id] }
230230
XCTAssertEqual(expectedIDs.reversed(), orderedIDs)
231231
}
232232

@@ -272,8 +272,8 @@ class QueryIntegrationTests: SQLiteTestCase {
272272
// https://github.com/stephencelis/SQLite.swift/issues/285
273273
func test_order_by_random() throws {
274274
try insertUsers(["a", "b", "c'"])
275-
let result: [_] = try db.prepare(users.select(email).order(SQLite.Expression<Int>.random()).limit(1))
276-
XCTAssertEqual(1, result.count)
275+
let result: [_] = try db.prepare(users.select(email).order(SQLite.Expression<Int>.random()).limit(1))
276+
XCTAssertEqual(1, result.count)
277277
}
278278

279279
func test_with_recursive() throws {
@@ -373,7 +373,7 @@ class QueryIntegrationTests: SQLiteTestCase {
373373
try insertUser("Billy")
374374

375375
let cumeDist = cumeDist(email)
376-
let results: [_] = try db.prepare(users.select(id, cumeDist)).map {
376+
let results: [_] = try db.prepare(users.select(id, cumeDist)).map {
377377
$0[cumeDist]
378378
}
379379
XCTAssertEqual([0.25, 0.5, 0.75, 1], results)
@@ -445,27 +445,27 @@ class QueryIntegrationTests: SQLiteTestCase {
445445
XCTAssertEqual(row[nthValue], "Billy@example.com")
446446
}
447447

448-
func test_codable_cast() throws {
449-
let table = Table("test_codable_cast")
450-
try db.run(
451-
table.create {
452-
$0.column(SQLite.Expression<String?>("int"))
453-
$0.column(SQLite.Expression<String?>("string"))
454-
$0.column(SQLite.Expression<String?>("bool"))
455-
$0.column(SQLite.Expression<String?>("float"))
456-
$0.column(SQLite.Expression<String?>("double"))
457-
$0.column(SQLite.Expression<String?>("date"))
458-
$0.column(SQLite.Expression<String?>("uuid"))
459-
$0.column(SQLite.Expression<String?>("optional"))
460-
$0.column(SQLite.Expression<String?>("sub"))
461-
})
462-
let value = TestCodable(int: 1, string: "2", bool: true, float: 3, double: 4,
463-
date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)
464-
try db.run(table.insert(value))
465-
466-
let fetchValue: TestCodable = try db.prepare(table).map { try $0.decode() }[0]
467-
XCTAssertEqual(fetchValue, value)
468-
}
448+
func test_codable_cast() throws {
449+
let table = Table("test_codable_cast")
450+
try db.run(
451+
table.create {
452+
$0.column(SQLite.Expression<String?>("int"))
453+
$0.column(SQLite.Expression<String?>("string"))
454+
$0.column(SQLite.Expression<String?>("bool"))
455+
$0.column(SQLite.Expression<String?>("float"))
456+
$0.column(SQLite.Expression<String?>("double"))
457+
$0.column(SQLite.Expression<String?>("date"))
458+
$0.column(SQLite.Expression<String?>("uuid"))
459+
$0.column(SQLite.Expression<String?>("optional"))
460+
$0.column(SQLite.Expression<String?>("sub"))
461+
})
462+
let value = TestCodable(int: 1, string: "2", bool: true, float: 3, double: 4,
463+
date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)
464+
try db.run(table.insert(value))
465+
466+
let fetchValue: TestCodable = try db.prepare(table).map { try $0.decode() }[0]
467+
XCTAssertEqual(fetchValue, value)
468+
}
469469
}
470470

471471
extension Connection {

Tests/SQLiteTests/Typed/RowTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RowTests: XCTestCase {
3131
}
3232

3333
public func test_get_value_optional_nil() throws {
34-
let row = Row(["\"foo\"": 0], [String?.none])
34+
let row = Row(["\"foo\"": 0], [String?.none])
3535
let result = try row.get(SQLite.Expression<String?>("foo"))
3636

3737
XCTAssertNil(result)

0 commit comments

Comments
 (0)