API tweaks

This commit is contained in:
Gwendal Roué committed 2015-07-02 23:34:38 +02:00
1 parent e137ef7fff
commit a063982802
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -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
View File
@@ -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")