Skip to content

Commit

Permalink
Merge pull request #12 from siemensikkema/feature/update-fluent
Browse files Browse the repository at this point in the history
Feature/update fluent
  • Loading branch information
m-barthelemy authored Jun 17, 2020
2 parents 7eda983 + 7d1ea8e commit 5293ae1
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 52 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/swift.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: test
on:
pull_request:
push:
branches:
- master
jobs:
linux:
runs-on: ubuntu-latest
container: swift:5.2-bionic
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run tests with Thread Sanitizer
run: swift test --enable-test-discovery --sanitize=thread
macOS:
runs-on: macos-latest
steps:
- name: Select latest available Xcode
uses: maxim-lobanov/setup-xcode@1.0
with:
xcode-version: latest
- name: Check out code
uses: actions/checkout@v2
- name: Run tests with Thread Sanitizer
run: swift test --enable-test-discovery --sanitize=thread
9 changes: 5 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent.git", from: "4.0.0-rc.3"),
.package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.1.0"),
.package(url: "https://github.com/vapor/queues.git", from: "1.1.0"),
],
Expand All @@ -29,9 +29,10 @@ let package = Package(
.product(name: "Queues", package: "queues")
],
path: "Sources"
)
/*.testTarget(
),
.testTarget(
name: "QueuesFluentDriverTests",
dependencies: ["QueuesFluentDriver"]),*/
dependencies: ["QueuesFluentDriver"]
),
]
)
4 changes: 1 addition & 3 deletions Sources/QueuesFluentDriver/FluentQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ extension FluentQueue: Queue {
}

public func set(_ id: JobIdentifier, to jobStorage: JobData) -> EventLoopFuture<Void> {
//let data = try! JSONEncoder().encode(jobStorage)
do {
let jobModel = try JobModel(jobId: id.string, queue: queueName.string, data: jobStorage)
return jobModel.save(on: db)
}
catch {
return db.eventLoop.makeFailedFuture(QueuesFluentError.jobDataEncodingError(error.localizedDescription))
}

}
}

public func clear(_ id: JobIdentifier) -> EventLoopFuture<Void> {
Expand Down
4 changes: 2 additions & 2 deletions Sources/QueuesFluentDriver/FluentQueuesDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public struct FluentQueuesDriver {
let useSoftDeletes: Bool
let eventLoopGroup: EventLoopGroup

init(on databaseId: DatabaseID? = nil, useSoftDeletes: Bool, on: EventLoopGroup) {
init(on databaseId: DatabaseID? = nil, useSoftDeletes: Bool, on eventLoopGroup: EventLoopGroup) {
self.databaseId = databaseId
self.useSoftDeletes = useSoftDeletes
self.eventLoopGroup = on
self.eventLoopGroup = eventLoopGroup
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/QueuesFluentDriver/PopQueries/MySQLPopQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import SQLKit
import Fluent

final class MySQLPop : PopQueryProtocol {
final class MySQLPop: PopQueryProtocol {
// MySQL is a bit challenging since it doesn't support updating a table that is
// used in a subquery.
// So we first select, then update, with the whole process wrapped in a transaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
import SQLKit
import Fluent

final class PostgresPop : PopQueryProtocol {
final class PostgresPop: PopQueryProtocol {
func pop(db: Database, select: SQLExpression) -> EventLoopFuture<String?> {
let db = db as! SQLDatabase
let subQueryGroup = SQLGroupExpression.init(select)
Expand Down
2 changes: 1 addition & 1 deletion Sources/QueuesFluentDriver/PopQueries/SqlitePopQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import SQLKit
import Fluent

final class SqlitePop : PopQueryProtocol {
final class SqlitePop: PopQueryProtocol {
func pop(db: Database, select: SQLExpression) -> EventLoopFuture<String?> {
db.transaction { transaction in
let database = transaction as! SQLDatabase
Expand Down
2 changes: 1 addition & 1 deletion Sources/QueuesFluentDriver/SQLExpressionExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ enum SQLSkipLocked: SQLExpression {
}
}

enum SqlReturning : SQLExpression {
enum SqlReturning: SQLExpression {
/// `RETURNING *`
case all
case column(_ column: FieldKey)
Expand Down
8 changes: 1 addition & 7 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
import XCTest

import QueuesFluentDriverTests

var tests = [XCTestCaseEntry]()
tests += QueuesFluentDriverTests.allTests()
XCTMain(tests)
fatalError("Please use swift test --enable-test-discovery to run the tests instead")
4 changes: 0 additions & 4 deletions Tests/QueuesFluentDriverTests/QueuesFluentDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ final class QueuesFluentDriverTests: XCTestCase {
// results.
//XCTAssertEqual(QueuesFluentDriver().text, "Hello, World!")
}

static var allTests = [
("testExample", testExample),
]
}
9 changes: 0 additions & 9 deletions Tests/QueuesFluentDriverTests/XCTestManifests.swift

This file was deleted.

0 comments on commit 5293ae1

Please sign in to comment.