Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/.codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ ignore:
- ^Tests/.*
- ^.build/.*
slack_app: false

8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ updates:
dependencies:
patterns:
- "*"
- package-ecosystem: "swift"
directory: "/"
schedule:
interval: "daily"
groups:
dependencies:
patterns:
- "*"
25 changes: 17 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ concurrency:
on:
pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
push: { branches: [ main ] }
env:
LOG_LEVEL: info
permissions:
contents: read

jobs:
unit-tests:
permissions:
contents: read
uses: vapor/ci/.github/workflows/run-unit-tests.yml@main
secrets: inherit
with:
Expand All @@ -20,6 +18,8 @@ jobs:

pure-fluent-integration-test:
if: ${{ !(github.event.pull_request.draft || false) }}
permissions:
contents: read
runs-on: ubuntu-latest
container: swift:6.2-noble
steps:
Expand All @@ -36,19 +36,21 @@ jobs:

integration-tests:
if: ${{ !(github.event.pull_request.draft || false) }}
permissions:
contents: read
services:
mysql-a:
image: mysql:latest
env: { MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database, MYSQL_ALLOW_EMPTY_PASSWORD: true }
env: &common_mysql_env { MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database, MYSQL_ALLOW_EMPTY_PASSWORD: true }
mysql-b:
image: mysql:latest
env: { MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database, MYSQL_ALLOW_EMPTY_PASSWORD: true }
env: *common_mysql_env
psql-a:
image: postgres:latest
env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database }
env: &common_psql_env { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database }
psql-b:
image: postgres:latest
env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database }
env: *common_psql_env
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -90,3 +92,10 @@ jobs:
run: |
swift package --package-path "${FLUENT_DRIVER}" edit --path sql-kit sql-kit
swift test --package-path "${FLUENT_DRIVER}" --sanitize=thread

submit-dependencies:
permissions:
contents: write
if: ${{ github.event_name == 'push' }}
uses: vapor/ci/.github/workflows/submit-deps.yml@main
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ extension SQLCommonTableExpressionBuilder {
/// This is the common "funnel" method invoked by all other methods provided by
/// ``SQLCommonTableExpressionBuilder``. Most users will not need to call this method directly.
///
/// See ``with(_:columns:as:)-28k4r`` and ``with(recursive:columns:as:)-6yef`` for usage examples.
/// See ``SQLCommonTableExpressionBuilder/with(_:columns:as:)-28k4r`` and ``SQLCommonTableExpressionBuilder/with(recursive:columns:as:)-6yef`` for usage examples.
///
/// > Warning: As with ``SQLCommonTableExpression``, ``SQLCommonTableExpressionBuilder`` does _NOT_ validate
/// > that a recursive CTE's query takes the proper form, nor that a non-recursive CTE's query is not
Expand Down
18 changes: 9 additions & 9 deletions Sources/SQLKit/Builders/Prototypes/SQLCommonUnionBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,55 +77,55 @@ extension SQLCommonUnionBuilder {
return self
}

/// Call ``union(distinct:)-15xs8`` with a query generated by a builder.
/// Call ``SQLCommonUnionBuilder/union(distinct:)-15xs8`` with a query generated by a builder.
@inlinable
public func union(distinct predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.union(distinct: predicate(SQLSubqueryBuilder()).select)
}

/// Call ``union(all:)-56f28`` with a query generated by a builder.
/// Call ``SQLCommonUnionBuilder/union(all:)-56f28`` with a query generated by a builder.
@inlinable
public func union(all predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.union(all: predicate(SQLSubqueryBuilder()).select)
}

/// Alias ``union(distinct:)-921p6`` so it acts as the "default".
/// Alias ``SQLCommonUnionBuilder/union(distinct:)-921p6`` so it acts as the "default".
@inlinable
public func union(_ predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.union(distinct: predicate)
}

/// Call ``intersect(distinct:)-161s9`` with a query generated by a builder.
/// Call ``SQLCommonUnionBuilder/intersect(distinct:)-161s9`` with a query generated by a builder.
@inlinable
public func intersect(distinct predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.intersect(distinct: predicate(SQLSubqueryBuilder()).select)
}

/// Call ``intersect(all:)-1wiow`` with a query generated by a builder.
/// Call ``SQLCommonUnionBuilder/intersect(all:)-1wiow`` with a query generated by a builder.
@inlinable
public func intersect(all predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.intersect(all: predicate(SQLSubqueryBuilder()).select)
}

/// Alias ``intersect(distinct:)-8f71m`` so it acts as the "default".
/// Alias ``SQLCommonUnionBuilder/intersect(distinct:)-8f71m`` so it acts as the "default".
@inlinable
public func intersect(_ predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.intersect(distinct: predicate)
}

/// Call ``except(distinct:)-2ygq0`` with a query generated by a builder.
/// Call ``SQLCommonUnionBuilder/except(distinct:)-2ygq0`` with a query generated by a builder.
@inlinable
public func except(distinct predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.except(distinct: predicate(SQLSubqueryBuilder()).select)
}

/// Call ``except(all:)-5exbl`` with a query generated by a builder.
/// Call ``SQLCommonUnionBuilder/except(all:)-5exbl`` with a query generated by a builder.
@inlinable
public func except(all predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.except(all: predicate(SQLSubqueryBuilder()).select)
}

/// Alias ``except(distinct:)-62w7q`` so it acts as the "default".
/// Alias ``SQLCommonUnionBuilder/except(distinct:)-62w7q`` so it acts as the "default".
@inlinable
public func except(_ predicate: (any SQLSubqueryClauseBuilder) throws -> any SQLSubqueryClauseBuilder) rethrows -> Self {
try self.except(distinct: predicate)
Expand Down
6 changes: 3 additions & 3 deletions Sources/SQLKit/Docs.docc/BasicUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ WHERE "name" <> NULL AND ("name" = ?1 OR "name" = ?2) -- bindings: ["Milky Way",

### Insert

The ``SQLDatabase/insert(into:)-67oqt`` and ``SQLDatabase/insert(into:)-5n3gh`` methods create an `INSERT` query builder:
The ``SQLDatabase/insert(into:)-(String)`` and ``SQLDatabase/insert(into:)-(SQLExpression)`` methods create an `INSERT` query builder:

```swift
try await db.insert(into: "galaxies")
Expand Down Expand Up @@ -236,7 +236,7 @@ This code generates the same SQL as would `builder.columns("name").values("Milky

### Update

The ``SQLDatabase/update(_:)-2tf1c`` and ``SQLDatabase/update(_:)-80964`` methods create an `UPDATE` query builder:
The ``SQLDatabase/update(_:)-(String)`` and ``SQLDatabase/update(_:)-(SQLExpression)`` methods create an `UPDATE` query builder:

```swift
try await db.update("planets")
Expand All @@ -255,7 +255,7 @@ The update builder supports the same `where()` and `orWhere()` methods as the se

### Delete

The ``SQLDatabase/delete(from:)-3tx4f`` and ``SQLDatabase/delete(from:)-4bqlu`` methods create a `DELETE` query builder:
The ``SQLDatabase/delete(from:)-(String)`` and ``SQLDatabase/delete(from:)-(SQLExpression)`` methods create a `DELETE` query builder:

```swift
try await db.delete(from: "planets")
Expand Down
53 changes: 39 additions & 14 deletions Sources/SQLKit/Docs.docc/Resources/vapor-sqlkit-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 31 additions & 30 deletions Sources/SQLKit/Docs.docc/SQLDatabase+ExtensionDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,41 @@

### DML queries

- ``SQLDatabase/delete(from:)-3tx4f``
- ``SQLDatabase/delete(from:)-4bqlu``
- ``SQLDatabase/insert(into:)-67oqt``
- ``SQLDatabase/insert(into:)-5n3gh``
- ``SQLDatabase/delete(from:)-(String)``
- ``SQLDatabase/delete(from:)-(SQLExpression)``
- ``SQLDatabase/insert(into:)-(String)``
- ``SQLDatabase/insert(into:)-(SQLExpression)``
- ``SQLDatabase/select()``
- ``SQLDatabase/union(_:)``
- ``SQLDatabase/update(_:)-2tf1c``
- ``SQLDatabase/update(_:)-80964``
- ``SQLDatabase/update(_:)-(String)``
- ``SQLDatabase/update(_:)-(SQLExpression)``

### DDL queries

- ``SQLDatabase/alter(table:)-42uao``
- ``SQLDatabase/alter(table:)-68pbr``
- ``SQLDatabase/create(table:)-czz4``
- ``SQLDatabase/create(table:)-2wdmn``
- ``SQLDatabase/drop(table:)-938qt``
- ``SQLDatabase/drop(table:)-7k2ai``

- ``SQLDatabase/alter(enum:)-66oin``
- ``SQLDatabase/alter(enum:)-7nb5b``
- ``SQLDatabase/create(enum:)-81hl4``
- ``SQLDatabase/create(enum:)-70oeh``
- ``SQLDatabase/drop(enum:)-5leu1``
- ``SQLDatabase/drop(enum:)-3jgv``

- ``SQLDatabase/create(index:)-7yh28``
- ``SQLDatabase/create(index:)-1iuey``
- ``SQLDatabase/drop(index:)-62i2j``
- ``SQLDatabase/drop(index:)-19tfk``

- ``SQLDatabase/create(trigger:table:when:event:)-6ntdo``
- ``SQLDatabase/create(trigger:table:when:event:)-9upcb``
- ``SQLDatabase/drop(trigger:)-53mq6``
- ``SQLDatabase/drop(trigger:)-5sfa8``
- ``SQLDatabase/alter(table:)-(String)``
- ``SQLDatabase/alter(table:)-(SQLIdentifier)``
- ``SQLDatabase/alter(table:)-(SQLExpression)``
- ``SQLDatabase/create(table:)-(String)``
- ``SQLDatabase/create(table:)-(SQLExpression)``
- ``SQLDatabase/drop(table:)-(String)``
- ``SQLDatabase/drop(table:)-(SQLExpression)``

- ``SQLDatabase/alter(enum:)-(String)``
- ``SQLDatabase/alter(enum:)-(SQLExpression)``
- ``SQLDatabase/create(enum:)-(String)``
- ``SQLDatabase/create(enum:)-(SQLExpression)``
- ``SQLDatabase/drop(enum:)-(String)``
- ``SQLDatabase/drop(enum:)-(SQLExpression)``

- ``SQLDatabase/create(index:)-(String)``
- ``SQLDatabase/create(index:)-(SQLExpression)``
- ``SQLDatabase/drop(index:)-(String)``
- ``SQLDatabase/drop(index:)-(SQLExpression)``

- ``SQLDatabase/create(trigger:table:when:event:)-(String,_,_,_)``
- ``SQLDatabase/create(trigger:table:when:event:)-(SQLExpression,_,_,_)``
- ``SQLDatabase/drop(trigger:)-(String)``
- ``SQLDatabase/drop(trigger:)-(SQLExpression)``

### Raw queries

Expand All @@ -63,4 +64,4 @@

### Legacy query interface

- ``SQLDatabase/execute(sql:_:)-90wi9``
- ``SQLDatabase/execute(sql:_:)->_``
56 changes: 28 additions & 28 deletions Sources/SQLKit/Docs.docc/SQLQueryFetcher+ExtensionDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@

### Getting Rows

- ``SQLQueryFetcher/run(_:)-40swz``
- ``SQLQueryFetcher/run(decoding:_:)-476q1``
- ``SQLQueryFetcher/run(decoding:prefix:keyDecodingStrategy:userInfo:_:)-583ot``
- ``SQLQueryFetcher/run(decoding:with:_:)-8y7ux``
- ``SQLQueryFetcher/run(_:)->()``
- ``SQLQueryFetcher/run(decoding:_:)->()``
- ``SQLQueryFetcher/run(decoding:prefix:keyDecodingStrategy:userInfo:_:)->()``
- ``SQLQueryFetcher/run(decoding:with:_:)->()``

### Getting All Rows

- ``SQLQueryFetcher/all()-8yci1``
- ``SQLQueryFetcher/all(decoding:)-5dt2x``
- ``SQLQueryFetcher/all(decoding:prefix:keyDecodingStrategy:userInfo:)-5u1nz``
- ``SQLQueryFetcher/all(decoding:with:)-6n5ox``
- ``SQLQueryFetcher/all(decodingColumn:as:)-7x9bs``
- ``SQLQueryFetcher/all(decoding:with:)->[D]``
- ``SQLQueryFetcher/all(decoding:)->[D]``
- ``SQLQueryFetcher/all(decoding:prefix:keyDecodingStrategy:userInfo:)->[D]``
- ``SQLQueryFetcher/all(decoding:with:)->[D]``
- ``SQLQueryFetcher/all(decodingColumn:as:)->[D]``

### Getting One Row

- ``SQLQueryFetcher/first()-99pqx``
- ``SQLQueryFetcher/first(decoding:)-63noi``
- ``SQLQueryFetcher/first(decoding:prefix:keyDecodingStrategy:userInfo:)-2str1``
- ``SQLQueryFetcher/first(decoding:with:)-58l9p``
- ``SQLQueryFetcher/first(decodingColumn:as:)-1bcz6``
- ``SQLQueryFetcher/first()->EventLoopFuture<(SQLRow)?>``
- ``SQLQueryFetcher/first(decoding:)->D?``
- ``SQLQueryFetcher/first(decoding:prefix:keyDecodingStrategy:userInfo:)->D?``
- ``SQLQueryFetcher/first(decoding:with:)->D?``
- ``SQLQueryFetcher/first(decodingColumn:as:)->D?``

### Legacy `EventLoopFuture` Interfaces

- ``SQLQueryFetcher/run(_:)-542bs``
- ``SQLQueryFetcher/run(decoding:_:)-6z89k``
- ``SQLQueryFetcher/run(decoding:prefix:keyDecodingStrategy:userInfo:_:)-2cp56``
- ``SQLQueryFetcher/run(decoding:with:_:)-4tte7``
- ``SQLQueryFetcher/all()-5j67e``
- ``SQLQueryFetcher/all(decoding:)-6q02f``
- ``SQLQueryFetcher/all(decoding:prefix:keyDecodingStrategy:userInfo:)-91za9``
- ``SQLQueryFetcher/all(decoding:with:)-5fc4b``
- ``SQLQueryFetcher/all(decodingColumn:as:)-197ym``
- ``SQLQueryFetcher/first()-7o93q``
- ``SQLQueryFetcher/first(decoding:)-6gqh3``
- ``SQLQueryFetcher/first(decoding:prefix:keyDecodingStrategy:userInfo:)-4hfrz``
- ``SQLQueryFetcher/first(decoding:with:)-1n97m``
- ``SQLQueryFetcher/first(decodingColumn:as:)-4965m``
- ``SQLQueryFetcher/run(_:)->_``
- ``SQLQueryFetcher/run(decoding:_:)->_``
- ``SQLQueryFetcher/run(decoding:prefix:keyDecodingStrategy:userInfo:_:)->_``
- ``SQLQueryFetcher/run(decoding:with:_:)->_``
- ``SQLQueryFetcher/all()->EventLoopFuture<[SQLRow]>``
- ``SQLQueryFetcher/all(decoding:)->EventLoopFuture<[D]>``
- ``SQLQueryFetcher/all(decoding:prefix:keyDecodingStrategy:userInfo:)->EventLoopFuture<[D]>``
- ``SQLQueryFetcher/all(decoding:with:)->EventLoopFuture<[D]>``
- ``SQLQueryFetcher/all(decodingColumn:as:)->EventLoopFuture<[D]>``
- ``SQLQueryFetcher/first()->EventLoopFuture<(SQLRow)?>``
- ``SQLQueryFetcher/first(decoding:)->EventLoopFuture<D?>``
- ``SQLQueryFetcher/first(decoding:prefix:keyDecodingStrategy:userInfo:)->EventLoopFuture<D?>``
- ``SQLQueryFetcher/first(decoding:with:)->EventLoopFuture<D?>``
- ``SQLQueryFetcher/first(decodingColumn:as:)->EventLoopFuture<D?>``
2 changes: 1 addition & 1 deletion Sources/SQLKit/Docs.docc/theme-settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"theme": {
"aside": { "border-radius": "16px", "border-style": "double", "border-width": "3px" },
"aside": { "border-radius": "16px", "border-width": "3px", "border-style": "double" },
"border-radius": "0",
"button": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
"code": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
Expand Down
Loading
Loading