Skip to content

Commit 37c1a39

Browse files
authored
Leverage improvements in SQLKit and SQLiteNIO (vapor#108)
* Update package structure, bump Swift minimum to 5.8, require an SQLKit we actually need, update CI, fix ExistentialAny usage, fix readme, update docs and logo * Sendable correctness, de-underscore the SQLite version type, add support for specifying JSON encoders and decoders, add support for new SQLKit functionality, default to singleton NIOThreadPool, modernize data encoder and decoder to handle data better and faster * Add 100% doc comments coverage * Use un-deprecated SQLBenchmarker API * Update dep minimums * Take advantage of further improvements in SQLiteNIO - SQLiteDatabase is Sendable, support queryLogLevel, don't do extra thread hops in withSession() * Pedantically avoid API breakage with SQLiteDatabase.sql() and make it @inlinable, fix a Sendability warning, add a missing doc comment.
1 parent e9fd69b commit 37c1a39

18 files changed

+723
-246
lines changed

.github/CODEOWNERS

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
* @0xTim @gwynne
1+
* @gwynne
2+
/.github/CONTRIBUTING.md @gwynne @0xTim
3+
/.github/workflows/*.yml @gwynne @0xTim
4+
/.github/workflows/test.yml @gwynne
5+
/.spi.yml @gwynne @0xTim
6+
/.gitignore @gwynne @0xTim
7+
/LICENSE @gwynne @0xTim
8+
/README.md @gwynne @0xTim

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
version: 2
2-
enable-beta-ecosystems: true
32
updates:
43
- package-ecosystem: "github-actions"
54
directory: "/"
@@ -9,14 +8,3 @@ updates:
98
dependencies:
109
patterns:
1110
- "*"
12-
- package-ecosystem: "swift"
13-
directory: "/"
14-
schedule:
15-
interval: "daily"
16-
open-pull-requests-limit: 6
17-
allow:
18-
- dependency-type: all
19-
groups:
20-
all-dependencies:
21-
patterns:
22-
- "*"

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ jobs:
1515
# also serves as code coverage baseline update
1616
unit-tests:
1717
uses: vapor/ci/.github/workflows/run-unit-tests.yml@main
18+
secrets: inherit
1819

1920
# Make sure downstream dependents still work
2021
dependents-check:
2122
if: ${{ !(github.event.pull_request.draft || false) }}
2223
runs-on: ubuntu-latest
23-
container: swift:5.9-jammy
24+
container: swift:5.10-jammy
2425
steps:
2526
- name: Check out package
2627
uses: actions/checkout@v4

Package.swift

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version:5.8
22
import PackageDescription
33

44
let package = Package(
@@ -13,21 +13,34 @@ let package = Package(
1313
.library(name: "SQLiteKit", targets: ["SQLiteKit"]),
1414
],
1515
dependencies: [
16-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.62.0"),
16+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.65.0"),
1717
.package(url: "https://github.com/vapor/sqlite-nio.git", from: "1.8.4"),
18-
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.28.0"),
18+
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.29.3"),
1919
.package(url: "https://github.com/vapor/async-kit.git", from: "1.19.0"),
2020
],
2121
targets: [
22-
.target(name: "SQLiteKit", dependencies: [
23-
.product(name: "NIOFoundationCompat", package: "swift-nio"),
24-
.product(name: "AsyncKit", package: "async-kit"),
25-
.product(name: "SQLiteNIO", package: "sqlite-nio"),
26-
.product(name: "SQLKit", package: "sql-kit"),
27-
]),
28-
.testTarget(name: "SQLiteKitTests", dependencies: [
29-
.product(name: "SQLKitBenchmark", package: "sql-kit"),
30-
.target(name: "SQLiteKit"),
31-
]),
22+
.target(
23+
name: "SQLiteKit",
24+
dependencies: [
25+
.product(name: "NIOFoundationCompat", package: "swift-nio"),
26+
.product(name: "AsyncKit", package: "async-kit"),
27+
.product(name: "SQLiteNIO", package: "sqlite-nio"),
28+
.product(name: "SQLKit", package: "sql-kit"),
29+
],
30+
swiftSettings: swiftSettings
31+
),
32+
.testTarget(
33+
name: "SQLiteKitTests",
34+
dependencies: [
35+
.product(name: "SQLKitBenchmark", package: "sql-kit"),
36+
.target(name: "SQLiteKit"),
37+
],
38+
swiftSettings: swiftSettings
39+
),
3240
]
3341
)
42+
43+
var swiftSettings: [SwiftSetting] { [
44+
.enableUpcomingFeature("ConciseMagicFile"),
45+
.enableUpcomingFeature("ForwardTrailingClosures"),
46+
] }

Package@swift-5.9.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// swift-tools-version:5.9
22
import PackageDescription
33

4-
let swiftSettings: [SwiftSetting] = [
5-
.enableUpcomingFeature("ExistentialAny"),
6-
.enableExperimentalFeature("StrictConcurrency=complete"),
7-
]
8-
94
let package = Package(
105
name: "sqlite-kit",
116
platforms: [
@@ -18,9 +13,9 @@ let package = Package(
1813
.library(name: "SQLiteKit", targets: ["SQLiteKit"]),
1914
],
2015
dependencies: [
21-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.62.0"),
16+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.65.0"),
2217
.package(url: "https://github.com/vapor/sqlite-nio.git", from: "1.8.4"),
23-
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.28.0"),
18+
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.29.3"),
2419
.package(url: "https://github.com/vapor/async-kit.git", from: "1.19.0"),
2520
],
2621
targets: [
@@ -44,3 +39,11 @@ let package = Package(
4439
),
4540
]
4641
)
42+
43+
var swiftSettings: [SwiftSetting] { [
44+
.enableUpcomingFeature("ExistentialAny"),
45+
.enableUpcomingFeature("ConciseMagicFile"),
46+
.enableUpcomingFeature("ForwardTrailingClosures"),
47+
.enableUpcomingFeature("DisableOutwardActorInference"),
48+
.enableExperimentalFeature("StrictConcurrency=complete"),
49+
] }

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
11
<p align="center">
22
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/vapor/sqlite-kit/assets/1130717/2d99c0b9-35e5-4f04-bb6c-8d59ff6e78c6">
4-
<source media="(prefers-color-scheme: light)" srcset="https://github.com/vapor/sqlite-kit/assets/1130717/cb36f94d-3ac3-4fba-b801-fe19eac7dbc2">
5-
<img src="https://github.com/vapor/sqlite-kit/assets/1130717/cb36f94d-3ac3-4fba-b801-fe19eac7dbc2" height="96" alt="SQLiteKit">
3+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/vapor/sqlite-kit/assets/1130717/81e423ff-d8b7-49f7-8c40-0287b3f025cf">
4+
<source media="(prefers-color-scheme: light)" srcset="https://github.com/vapor/sqlite-kit/assets/1130717/79147036-e050-4a87-be7c-68d6d2c40717">
5+
<img src="https://github.com/vapor/sqlite-kit/assets/1130717/79147036-e050-4a87-be7c-68d6d2c40717" height="96" alt="SQLiteKit">
66
</picture>
77
<br>
88
<br>
99
<a href="https://docs.vapor.codes/4.0/"><img src="https://design.vapor.codes/images/readthedocs.svg" alt="Documentation"></a>
1010
<a href="https://discord.gg/vapor"><img src="https://design.vapor.codes/images/discordchat.svg" alt="Team Chat"></a>
1111
<a href="LICENSE"><img src="https://design.vapor.codes/images/mitlicense.svg" alt="MIT License"></a>
1212
<a href="https://github.com/vapor/sqlite-kit/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/vapor/sqlite-kit/test.yml?event=push&style=plastic&logo=github&label=test&logoColor=%23ccc" alt="Continuous Integration"></a>
13-
<a href="https://codecov.io/github/vapor/sqlite-kit"><img src="https://img.shields.io/codecov/c/github/vapor/sqlite-kit?style=plastic&logo=codecov&label=Codecov"></a>
14-
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift57up.svg" alt="Swift 5.7+"></a>
15-
<a href="https://www.swift.org/sswg/incubation-process.html"><img src="https://design.vapor.codes/images/sswg-graduated-white.svg" alt="SSWG Incubation Level: Graduated"></a>
13+
<a href="https://codecov.io/github/vapor/sqlite-kit"><img src="https://img.shields.io/codecov/c/github/vapor/sqlite-kit?style=plastic&logo=codecov&label=codecov"></a>
14+
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift58up.svg" alt="Swift 5.8+"></a>
15+
<a href="https://www.swift.org/sswg/incubation-process.html"><img src="https://design.vapor.codes/images/sswg-graduated.svg" alt="SSWG Incubation Level: Graduated"></a>
1616
</p>
1717

1818
<br>
1919

20-
SQLiteKit is a library providing an [SQLKit] driver for [SQLiteNIO].
20+
SQLiteKit is an [SQLKit] driver for SQLite clients. It supports building and serializing SQLite-dialect SQL queries. SQLiteKit uses [SQLiteNIO] to connect and communicate with the database server asynchronously. [AsyncKit] is used to provide connection pooling.
2121

22-
> [!NOTE]
23-
> The [FluentKit] driver for SQLite is provided by the [FluentSQLiteDriver] package.
22+
[SQLKit]: https://github.com/vapor/sql-kit
23+
[SQLiteNIO]: https://github.com/vapor/sqlite-nio
24+
[AsyncKit]: https://github.com/vapor/async-kit
2425

25-
[SQLKit]: https://swiftpackageindex.com/vapor/sql-kit
26-
[SQLiteNIO]: https://swiftpackageindex.com/vapor/sqlite-nio
27-
[Fluent]: https://swiftpackageindex.com/vapor/fluent-kit
28-
[FluentSQLiteDriver]: https://swiftpackageindex.com/vapor/fluent-sqlite-driver
26+
### Usage
27+
28+
Use the SPM string to easily include the dependendency in your `Package.swift` file.
29+
30+
```swift
31+
.package(url: "https://github.com/vapor/sqlite-kit.git", from: "4.0.0")
32+
```
33+
34+
### Supported Platforms
35+
36+
SQLiteKit supports the following platforms:
37+
38+
- Ubuntu 20.04+
39+
- macOS 10.15+

Sources/SQLiteKit/Docs.docc/Documentation.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ This package provides the "foundational" level of support for using [Fluent] wit
1212

1313
- Managing the underlying SQLite library ([SQLiteNIO]),
1414
- Providing a two-way bridge between SQLiteNIO and SQLKit's generic data and metadata formats,
15-
- Presenting an interface for establishing, managing, and interacting with database connections.
15+
- Presenting an interface for establishing, managing, and interacting with database connections via [AsyncKit].
1616

17-
> Note: The FluentKit driver for SQLite is provided by the [FluentSQLiteDriver] package.
17+
> Tip: The FluentKit driver for SQLite is provided by the [FluentSQLiteDriver] package.
18+
19+
## Version Support
20+
21+
This package uses [SQLiteNIO] for all underlying database interactions. The version of SQLite embedded by that package is always the one used.
1822

1923
[SQLKit]: https://swiftpackageindex.com/vapor/sql-kit
2024
[SQLiteNIO]: https://swiftpackageindex.com/vapor/sqlite-nio
2125
[Fluent]: https://swiftpackageindex.com/vapor/fluent-kit
2226
[FluentSQLiteDriver]: https://swiftpackageindex.com/vapor/fluent-sqlite-driver
27+
[AsyncKit]: https://swiftpackageindex.com/vapor/async-kit
Lines changed: 13 additions & 14 deletions
Loading

Sources/SQLiteKit/Docs.docc/theme-settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"theme": {
3-
"aside": { "border-radius": "6px", "border-style": "double", "border-width": "3px" },
3+
"aside": { "border-radius": "16px", "border-style": "double", "border-width": "3px" },
44
"border-radius": "0",
55
"button": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
66
"code": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
77
"color": {
8-
"sqlite": "hsl(215, 45%, 58%)",
9-
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-sqlite) 30%, #000 100%)",
10-
"documentation-intro-accent": "var(--color-sqlite)",
8+
"sqlitekit": "hsl(215, 45%, 58%)",
9+
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-sqlitekit) 30%, #000 100%)",
10+
"documentation-intro-accent": "var(--color-sqlitekit)",
1111
"logo-base": { "dark": "#fff", "light": "#000" },
1212
"logo-shape": { "dark": "#000", "light": "#fff" },
1313
"fill": { "dark": "#000", "light": "#fff" }

Sources/SQLiteKit/Exports.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
#if swift(>=5.8)
2-
31
@_documentation(visibility: internal) @_exported import SQLKit
42
@_documentation(visibility: internal) @_exported import SQLiteNIO
53
@_documentation(visibility: internal) @_exported import AsyncKit
64
@_documentation(visibility: internal) @_exported import struct Logging.Logger
7-
8-
#else
9-
10-
@_exported import SQLKit
11-
@_exported import SQLiteNIO
12-
@_exported import AsyncKit
13-
@_exported import struct Logging.Logger
14-
15-
#endif

0 commit comments

Comments
 (0)