diff --git a/.gitignore b/.gitignore index ea8fec49..03bf1b34 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ /*.xcodeproj Package.resolved DerivedData +.swiftpm diff --git a/LICENSE b/LICENSE index dbc42719..c7d50b5c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Qutheory, LLC +Copyright (c) 2019 Qutheory, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index bd8d5d3d..51626fd1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@

- SQL + SQLKit

- - Documentation + + Documentation Team Chat @@ -11,8 +11,8 @@ MIT License - - Continuous Integration + + Continuous Integration Swift 5 diff --git a/Sources/SQLKit/Builders/SQLAlterTableBuilder.swift b/Sources/SQLKit/Builders/SQLAlterTableBuilder.swift index 1d64dc0f..ba816106 100644 --- a/Sources/SQLKit/Builders/SQLAlterTableBuilder.swift +++ b/Sources/SQLKit/Builders/SQLAlterTableBuilder.swift @@ -1,10 +1,3 @@ -/// Builds `ALTER TABLE` queries. -/// -/// conn.alter(table: Planet.self) -/// .column(for: \.name) -/// .run() -/// -/// See `SQLColumnBuilder` for more information. public final class SQLAlterTableBuilder: SQLQueryBuilder, SQLColumnBuilder { /// `SQLAlterTable` query being built. public var alterTable: SQLAlterTable diff --git a/Sources/SQLKit/Builders/SQLQueryBuilder.swift b/Sources/SQLKit/Builders/SQLQueryBuilder.swift index b9757196..f029c679 100644 --- a/Sources/SQLKit/Builders/SQLQueryBuilder.swift +++ b/Sources/SQLKit/Builders/SQLQueryBuilder.swift @@ -19,6 +19,6 @@ extension SQLQueryBuilder { /// /// - returns: A future signaling completion. public func run() -> EventLoopFuture { - return self.database.sqlQuery(self.query) { _ in } + return self.database.execute(sql: self.query) { _ in } } } diff --git a/Sources/SQLKit/Builders/SQLQueryFetcher.swift b/Sources/SQLKit/Builders/SQLQueryFetcher.swift index 10abaa1f..a8b044a2 100644 --- a/Sources/SQLKit/Builders/SQLQueryFetcher.swift +++ b/Sources/SQLKit/Builders/SQLQueryFetcher.swift @@ -39,7 +39,7 @@ extension SQLQueryFetcher { /// /// The returned future will signal completion of the query. public func run(_ handler: @escaping (SQLRow) throws -> ()) -> EventLoopFuture { - return self.database.sqlQuery(self.query) { row in + return self.database.execute(sql: self.query) { row in try handler(row) } } diff --git a/Sources/SQLKit/Query/SQLCollation.swift b/Sources/SQLKit/Query/SQLCollation.swift deleted file mode 100644 index a12bbfad..00000000 --- a/Sources/SQLKit/Query/SQLCollation.swift +++ /dev/null @@ -1,2 +0,0 @@ -/// SQL character collations. -public protocol SQLCollation: SQLExpression { } diff --git a/Sources/SQLKit/Query/SQLConstraintAlgorithm.swift b/Sources/SQLKit/Query/SQLConstraintAlgorithm.swift index 67b35e35..0248cea4 100644 --- a/Sources/SQLKit/Query/SQLConstraintAlgorithm.swift +++ b/Sources/SQLKit/Query/SQLConstraintAlgorithm.swift @@ -12,13 +12,13 @@ public enum SQLConstraintAlgorithm: SQLExpression { /// `COLLATE` constraint. case check(SQLExpression) - case collate(SQLCollation) + case collate(SQLExpression) /// `DEFAULT` constraint. case `default`(SQLExpression) /// `FOREIGN KEY` constraint. - case foreignKey(SQLForeignKey) + case foreignKey(SQLExpression) public func serialize(to serializer: inout SQLSerializer) { switch self { diff --git a/Sources/SQLKit/SQLDatabase.swift b/Sources/SQLKit/SQLDatabase.swift index 0a4fba5d..76744bcf 100644 --- a/Sources/SQLKit/SQLDatabase.swift +++ b/Sources/SQLKit/SQLDatabase.swift @@ -1,6 +1,6 @@ public protocol SQLDatabase { - func sqlQuery( - _ query: SQLExpression, + func execute( + sql query: SQLExpression, _ onRow: @escaping (SQLRow) throws -> () ) -> EventLoopFuture } diff --git a/Tests/SQLKitTests/Utilities.swift b/Tests/SQLKitTests/Utilities.swift index 3a10bc75..90428ade 100644 --- a/Tests/SQLKitTests/Utilities.swift +++ b/Tests/SQLKitTests/Utilities.swift @@ -9,7 +9,7 @@ final class TestDatabase: SQLDatabase { self.results = [] } - func sqlQuery(_ query: SQLExpression, _ onRow: @escaping (SQLRow) throws -> ()) -> EventLoopFuture { + func execute(sql query: SQLExpression, _ onRow: @escaping (SQLRow) throws -> ()) -> EventLoopFuture { var serializer = SQLSerializer(dialect: GenericDialect()) query.serialize(to: &serializer) results.append(serializer.sql) diff --git a/circle.yml b/circle.yml index 962154ad..e27a9cac 100644 --- a/circle.yml +++ b/circle.yml @@ -1,22 +1,53 @@ version: 2 jobs: - linux: + macos: + macos: + xcode: "10.2.0" + steps: + - checkout + - run: swift build + - run: swift test + macos-release: + macos: + xcode: "10.2.0" + steps: + - checkout + - run: swift build -c release + bionic: docker: - - image: vapor/swift:5.0 + - image: swift:5.0-bionic steps: - checkout - run: swift build - run: swift test - linux-release: + bionic-release: docker: - - image: vapor/swift:5.0 + - image: swift:5.0-bionic steps: - checkout - run: swift build -c release + xenial: + docker: + - image: swift:5.0-xenial + steps: + - checkout + - run: swift build + - run: swift test + xenial-release: + docker: + - image: swift:5.0-xenial + steps: + - checkout + - run: swift build -c release + workflows: version: 2 tests: jobs: - - linux - - linux-release + - macos + - macos-release + - bionic + - bionic-release + - xenial + - xenial-release