Skip to content

Commit 621b76b

Browse files
tibGErP83
andauthored
Align codebase with feather database API 1.0.0-beta.3 release (#7)
⚠️ Breaking changes: - With-style API for transaction & connection - Using RowSequence in a handler instead of a return value - Query result renamed to RowSequence - Remove execute API from database client - Improve transaction error interface - Sendable fixes --------- Co-authored-by: GErP83 <gurrka@gmail.com>
1 parent c9b6270 commit 621b76b

20 files changed

Lines changed: 1070 additions & 969 deletions

.github/workflows/deployment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
tags:
66
- 'v*'
77
- '[0-9]*'
8+
workflow_dispatch:
89

910
jobs:
1011

.github/workflows/testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
format_check_enabled : true
1616
broken_symlink_check_enabled : true
1717
unacceptable_language_check_enabled : true
18-
shell_check_enabled : true
18+
shell_check_enabled : false
1919
docs_check_enabled : false
2020
api_breakage_check_enabled : false
2121
license_header_check_enabled : false
@@ -28,7 +28,7 @@ jobs:
2828
uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main
2929
with:
3030
local_swift_dependencies_check_enabled : true
31-
headers_check_enabled : true
31+
headers_check_enabled : false
3232
docc_warnings_check_enabled : true
3333

3434
swiftlang_tests:

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ SHELL=/bin/bash
22

33
baseUrl = https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts
44

5-
check: symlinks language deps lint headers
5+
check: symlinks language deps lint headers docc-warnings package
6+
7+
package:
8+
curl -s $(baseUrl)/check-swift-package.sh | bash
69

710
symlinks:
811
curl -s $(baseUrl)/check-broken-symlinks.sh | bash

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,30 @@ let package = Package(
3737
dependencies: [
3838
.package(url: "https://github.com/apple/swift-log", from: "1.6.0"),
3939
.package(url: "https://github.com/vapor/sqlite-nio", from: "1.12.0"),
40-
.package(url: "https://github.com/feather-framework/feather-database", exact: "1.0.0-beta.2"),
40+
.package(url: "https://github.com/feather-framework/feather-database", exact: "1.0.0-beta.3"),
4141
// [docc-plugin-placeholder]
4242
],
4343
targets: [
4444
.target(
45-
name: "FeatherSQLiteDatabase",
45+
name: "SQLiteNIOExtras",
4646
dependencies: [
4747
.product(name: "Logging", package: "swift-log"),
4848
.product(name: "SQLiteNIO", package: "sqlite-nio"),
49+
],
50+
swiftSettings: defaultSwiftSettings
51+
),
52+
.target(
53+
name: "FeatherSQLiteDatabase",
54+
dependencies: [
4955
.product(name: "FeatherDatabase", package: "feather-database"),
56+
.target(name: "SQLiteNIOExtras"),
57+
],
58+
swiftSettings: defaultSwiftSettings
59+
),
60+
.testTarget(
61+
name: "SQLiteNIOExtrasTests",
62+
dependencies: [
63+
.target(name: "SQLiteNIOExtras"),
5064
],
5165
swiftSettings: defaultSwiftSettings
5266
),

README.md

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,37 @@
22

33
SQLite driver implementation for the abstract [Feather Database](https://github.com/feather-framework/feather-database) Swift API package.
44

5-
[
6-
![Release: 1.0.0-beta.2](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E2-F05138)
7-
](
8-
https://github.com/feather-framework/feather-sqlite-database/releases/tag/1.0.0-beta.2
9-
)
5+
[![Release: 1.0.0-beta.3](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E3-F05138)](https://github.com/feather-framework/feather-sqlite-database/releases/tag/1.0.0-beta.3)
106

117
## Features
128

13-
- 🤝 SQLite driver for Feather Database
14-
- 😱 Automatic query parameter escaping via Swift string interpolation.
15-
- 🔄 Async sequence query results with `Decodable` row support.
16-
- 🧵 Designed for modern Swift concurrency
17-
- 📚 DocC-based API Documentation
18-
- Unit tests and code coverage
9+
- SQLite driver for Feather Database
10+
- Automatic query parameter escaping via Swift string interpolation.
11+
- Async sequence query results with `Decodable` row support.
12+
- Designed for modern Swift concurrency
13+
- DocC-based API Documentation
14+
- Unit tests and code coverage
1915

2016
## Requirements
2117

2218
![Swift 6.1+](https://img.shields.io/badge/Swift-6%2E1%2B-F05138)
2319
![Platforms: Linux, macOS, iOS, tvOS, watchOS, visionOS](https://img.shields.io/badge/Platforms-Linux_%7C_macOS_%7C_iOS_%7C_tvOS_%7C_watchOS_%7C_visionOS-F05138)
24-
25-
- Swift 6.1+
2620

27-
- Platforms:
28-
- Linux
29-
- macOS 15+
30-
- iOS 18+
31-
- tvOS 18+
32-
- watchOS 11+
33-
- visionOS 2+
21+
- Swift 6.1+
22+
- Platforms:
23+
- Linux
24+
- macOS 15+
25+
- iOS 18+
26+
- tvOS 18+
27+
- watchOS 11+
28+
- visionOS 2+
3429

3530
## Installation
3631

3732
Add the dependency to your `Package.swift`:
3833

3934
```swift
40-
.package(url: "https://github.com/feather-framework/feather-sqlite-database", exact: "1.0.0-beta.2"),
35+
.package(url: "https://github.com/feather-framework/feather-sqlite-database", exact: "1.0.0-beta.3"),
4136
```
4237

4338
Then add `FeatherSQLiteDatabase` to your target dependencies:
@@ -46,19 +41,13 @@ Then add `FeatherSQLiteDatabase` to your target dependencies:
4641
.product(name: "FeatherSQLiteDatabase", package: "feather-sqlite-database"),
4742
```
4843

49-
5044
## Usage
51-
52-
[
53-
![DocC API documentation](https://img.shields.io/badge/DocC-API_documentation-F05138)
54-
](
55-
https://feather-framework.github.io/feather-sqlite-database/documentation/feathersqlitedatabase/
56-
)
5745

58-
API documentation is available at the following link.
46+
API documentation is available at the link below:
47+
48+
[![DocC API documentation](https://img.shields.io/badge/DocC-API_documentation-F05138)](https://feather-framework.github.io/feather-sqlite-database/)
5949

60-
> [!TIP]
61-
> Avoid calling `database.execute` while in a transaction; use the transaction `connection` instead.
50+
Here is a brief example:
6251

6352
```swift
6453
import Logging
@@ -75,19 +64,25 @@ let configuration = SQLiteClient.Configuration(
7564
)
7665

7766
let client = SQLiteClient(configuration: configuration)
78-
try await client.run()
7967

80-
let database = SQLiteDatabaseClient(client: client)
81-
82-
let result = try await database.execute(
83-
query: #"""
84-
SELECT
85-
sqlite_version() AS "version"
86-
WHERE
87-
1=\#(1);
88-
"""#
68+
let database = SQLiteDatabaseClient(
69+
client: client,
70+
logger: logger
8971
)
9072

73+
try await client.run()
74+
75+
try await database.withConnection { connection in
76+
try await connection.run(
77+
query: #"""
78+
SELECT
79+
sqlite_version() AS "version"
80+
WHERE
81+
1=\#(1);
82+
"""#
83+
)
84+
}
85+
9186
for try await item in result {
9287
let version = try item.decode(column: "version", as: String.self)
9388
print(version)
@@ -99,7 +94,6 @@ await client.shutdown()
9994
> [!WARNING]
10095
> This repository is a work in progress, things can break until it reaches v1.0.0.
10196
102-
10397
## Other database drivers
10498

10599
The following database driver implementations are available for use:
@@ -110,12 +104,12 @@ The following database driver implementations are available for use:
110104
## Development
111105

112106
- Build: `swift build`
113-
- Test:
114-
- local: `swift test`
115-
- using Docker: `make docker-test`
107+
- Test:
108+
- local: `swift test`
109+
- using Docker: `make docker-test`
116110
- Format: `make format`
117111
- Check: `make check`
118112

119113
## Contributing
120114

121-
[Pull requests](https://github.com/feather-framework/feather-sqlite-database/pulls) are welcome. Please keep changes focused and include tests for new logic. 🙏
115+
[Pull requests](https://github.com/feather-framework/feather-sqlite-database/pulls) are welcome. Please keep changes focused and include tests for new logic.

Sources/FeatherSQLiteDatabase/SQLiteConnection.swift

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)