diff --git a/Sources/SwiftKnex/Knex+Transaction.swift b/Sources/SwiftKnex/Knex+Transaction.swift index c844d2b..162d090 100644 --- a/Sources/SwiftKnex/Knex+Transaction.swift +++ b/Sources/SwiftKnex/Knex+Transaction.swift @@ -8,7 +8,7 @@ extension Knex { - public func transaciton(_ callback: (Connection) throws -> Void) throws { + public func transaction(_ callback: (Connection) throws -> Void) throws { try self.connection.transaction { trx in try callback(trx) } diff --git a/Sources/SwiftKnex/Migration/Migrator.swift b/Sources/SwiftKnex/Migration/Migrator.swift index 4fb3972..3aa289d 100644 --- a/Sources/SwiftKnex/Migration/Migrator.swift +++ b/Sources/SwiftKnex/Migration/Migrator.swift @@ -112,7 +112,7 @@ class MigrateRunner { } func up() throws { - try con.knex().transaciton { trx in + try con.knex().transaction { trx in var recentMigrated = [String]() let migrationsPeformed = try fetchMigrations(trx: trx) @@ -153,7 +153,7 @@ class MigrateRunner { } func down() throws { - try con.knex().transaciton { trx in + try con.knex().transaction { trx in let migrationsPeformed = try fetchMigrations(trx: trx) if migrationsPeformed.isEmpty { print("Already up to date") diff --git a/Tests/SwiftKnexTests/DDLTests.swift b/Tests/SwiftKnexTests/DDLTests.swift index 04a0a78..8967c20 100644 --- a/Tests/SwiftKnexTests/DDLTests.swift +++ b/Tests/SwiftKnexTests/DDLTests.swift @@ -31,7 +31,7 @@ class DDLTests: XCTestCase { } func dropTable(){ - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in do { _ = try con.knex().execRaw(trx: trx, sql: Drop(table: "test_users").toDDL()) } catch { diff --git a/Tests/SwiftKnexTests/InsertTests.swift b/Tests/SwiftKnexTests/InsertTests.swift index 85f5309..26d1516 100644 --- a/Tests/SwiftKnexTests/InsertTests.swift +++ b/Tests/SwiftKnexTests/InsertTests.swift @@ -25,7 +25,7 @@ class InsertTests: XCTestCase { override func setUp() { con = try! KnexConnection(config: basicKnexConfig()) dropTable() - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in _ = try! con.knex().execRaw(trx: trx, sql: testUserSchema().toDDL()) } } diff --git a/Tests/SwiftKnexTests/JSONDataTypeTests.swift b/Tests/SwiftKnexTests/JSONDataTypeTests.swift index 427b23a..fb3ce38 100644 --- a/Tests/SwiftKnexTests/JSONDataTypeTests.swift +++ b/Tests/SwiftKnexTests/JSONDataTypeTests.swift @@ -29,7 +29,7 @@ class JSONDataTypeTests: XCTestCase { Schema.Field(name: "body", type: Schema.Types.JSON()) ]) - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in _ = try! con.knex().execRaw(trx: trx, sql: jsonTable.toDDL()) let json: [String: Any] = [ "name": "Luke", diff --git a/Tests/SwiftKnexTests/JoinTests.swift b/Tests/SwiftKnexTests/JoinTests.swift index 3c78654..d29f706 100644 --- a/Tests/SwiftKnexTests/JoinTests.swift +++ b/Tests/SwiftKnexTests/JoinTests.swift @@ -23,7 +23,7 @@ class JoinTests: XCTestCase { override func setUp() { con = try! KnexConnection(config: basicKnexConfig()) dropTable() - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in _ = try! con.knex().execRaw(trx: trx, sql: testUserSchema().toDDL()) _ = try! con.knex().insert(into: "test_users", collection: testUserCollection(), trx: trx) @@ -38,7 +38,7 @@ class JoinTests: XCTestCase { } func dropTable(){ - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in do { _ = try con.knex().execRaw(trx: trx, sql: Drop(table: "test_users").toDDL()) } catch { diff --git a/Tests/SwiftKnexTests/SelectTests.swift b/Tests/SwiftKnexTests/SelectTests.swift index 2a7075f..eebb16b 100644 --- a/Tests/SwiftKnexTests/SelectTests.swift +++ b/Tests/SwiftKnexTests/SelectTests.swift @@ -28,7 +28,7 @@ class SelectTests: XCTestCase { override func setUp() { con = try! KnexConnection(config: basicKnexConfig()) dropTable() - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in _ = try! con.knex().execRaw(trx: trx, sql: testUserSchema().toDDL()) _ = try! con.knex().insert(into: "test_users", collection: testUserCollection(), trx: trx) } diff --git a/Tests/SwiftKnexTests/TransactionTests.swift b/Tests/SwiftKnexTests/TransactionTests.swift index de8f0fb..d545c54 100644 --- a/Tests/SwiftKnexTests/TransactionTests.swift +++ b/Tests/SwiftKnexTests/TransactionTests.swift @@ -24,7 +24,7 @@ class TransactionTests: XCTestCase { override func setUp() { con = try! KnexConnection(config: basicKnexConfig()) dropTable() - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in _ = try! con.knex().execRaw(trx: trx, sql: testUserSchema().toDDL()) } } @@ -43,7 +43,7 @@ class TransactionTests: XCTestCase { } func testTransactionCommit(){ - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in XCTAssertEqual(con.knex().connection.availableConnection, 3) _ = try con.knex().insert(into: "test_users", collection: testUserCollection(), trx: trx) _ = try con.knex().table("test_users").where("id" == 1).update(sets: ["age": 10], trx: trx) @@ -59,7 +59,7 @@ class TransactionTests: XCTestCase { func testTransactionRollback() { do { - try con.knex().transaciton { trx in + try con.knex().transaction { trx in XCTAssertEqual(con.knex().connection.availableConnection, 3) _ = try con.knex().insert(into: "test_users", collection: testUserCollection(), trx: trx) _ = try con.knex().table("test_users").where("id" == 1).update(sets: ["age": 10], trx: trx) diff --git a/Tests/SwiftKnexTests/UpdateTests.swift b/Tests/SwiftKnexTests/UpdateTests.swift index 38168f8..f2b4bb9 100644 --- a/Tests/SwiftKnexTests/UpdateTests.swift +++ b/Tests/SwiftKnexTests/UpdateTests.swift @@ -23,7 +23,7 @@ class UpdateTests: XCTestCase { override func setUp() { con = try! KnexConnection(config: basicKnexConfig()) dropTable() - try! con.knex().transaciton { trx in + try! con.knex().transaction { trx in _ = try! con.knex().execRaw(trx: trx, sql: testUserSchema().toDDL()) _ = try! con.knex().insert(into: "test_users", collection: testUserCollection(), trx: trx) }