mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
API tweaks
This commit is contained in:
1 parent
e137ef7fff
commit
a063982802
2 files changed
+4
-4
No files matched your search
+1
-1
@@ -224,7 +224,7 @@ extension Database {
|
||||
}
|
||||
}
|
||||
|
||||
public func fetchOne<T: RowModel>(primaryKey primaryKey: DatabaseValue, type: T.Type) -> T? {
|
||||
public func fetchOne<T: RowModel>(type: T.Type, primaryKey: DatabaseValue) -> T? {
|
||||
guard let tableName = T.databaseTableName else {
|
||||
fatalError("Missing table name")
|
||||
}
|
||||
|
||||
+3
-3
@@ -547,7 +547,7 @@ class RowModelTests: GRDBTests {
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let arthur2 = db.fetchOne(primaryKey: arthur.ID!, type: Person.self)!
|
||||
let arthur2 = db.fetchOne(Person.self, primaryKey: arthur.ID!)!
|
||||
XCTAssertEqual(arthur2.age!, 42)
|
||||
}
|
||||
}
|
||||
@@ -584,7 +584,7 @@ class RowModelTests: GRDBTests {
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let arthur = db.fetchOne(primaryKey: arthurID!, type: Person.self)!
|
||||
let arthur = db.fetchOne(Person.self, primaryKey: arthurID!)!
|
||||
|
||||
XCTAssertEqual(arthur.ID!, arthurID!)
|
||||
XCTAssertEqual(arthur.name!, "Arthur")
|
||||
@@ -609,7 +609,7 @@ class RowModelTests: GRDBTests {
|
||||
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let pet = db.fetchOne(primaryKey: petUUID, type: Pet.self)!
|
||||
let pet = db.fetchOne(Pet.self, primaryKey: petUUID)!
|
||||
|
||||
XCTAssertEqual(pet.UUID!, petUUID)
|
||||
XCTAssertEqual(pet.name!, "Bobby")
|
||||
|
||||
Reference in new issue
Block a user