https://github.com/feather-framework/feather-sqlite-database
SQLite driver implementation for the abstract Feather Database Swift API package.
https://github.com/feather-framework/feather-sqlite-database
database sqlite swift-6 swift-concurrency
Last synced: 4 months ago
JSON representation
SQLite driver implementation for the abstract Feather Database Swift API package.
- Host: GitHub
- URL: https://github.com/feather-framework/feather-sqlite-database
- Owner: feather-framework
- License: mit
- Created: 2023-12-03T13:31:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-11T15:31:58.000Z (4 months ago)
- Last Synced: 2026-02-11T21:47:37.719Z (4 months ago)
- Topics: database, sqlite, swift-6, swift-concurrency
- Language: Swift
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# Feather SQLite Database
SQLite driver implementation for the abstract [Feather Database](https://github.com/feather-framework/feather-database) Swift API package.
[

](
https://github.com/feather-framework/feather-sqlite-database/releases/tag/1.0.0-beta.7
)
## Features
- SQLite driver for Feather Database
- Automatic query parameter escaping via Swift string interpolation.
- Async sequence query results with `Decodable` row support.
- Designed for modern Swift concurrency
- DocC-based API Documentation
- Unit tests and code coverage
## Requirements


- Swift 6.1+
- Platforms:
- Linux
- macOS 15+
- iOS 18+
- tvOS 18+
- watchOS 11+
- visionOS 2+
## Installation
Add the dependency to your `Package.swift`:
```swift
.package(url: "https://github.com/feather-framework/feather-sqlite-database", exact: "1.0.0-beta.5"),
```
Then add `FeatherSQLiteDatabase` to your target dependencies:
```swift
.product(name: "FeatherSQLiteDatabase", package: "feather-sqlite-database"),
```
### Package traits
This package offers additional integrations you can enable using [package traits](https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/addingdependencies#Packages-with-Traits).
To enable an additional trait on the package, update the package dependency:
```diff
.package(
url: "https://github.com/feather-framework/feather-sqlite-database",
exact: "1.0.0-beta.4",
+ traits: [
+ .defaults,
+ "ServiceLifecycleSupport",
+ ]
)
```
Available traits:
- `ServiceLifecycleSupport` (default): Adds support for `SQLiteClientService`, a `ServiceLifecycle.Service` implementation for managing SQLite clients.
## Usage
API documentation is available at the link below:
[

](
https://feather-framework.github.io/feather-sqlite-database/
)
Here is a brief example:
```swift
import Logging
import SQLiteNIO
import FeatherDatabase
import FeatherSQLiteDatabase
var logger = Logger(label: "example")
logger.logLevel = .info
let configuration = SQLiteClient.Configuration(
storage: .file(path: "/Users/me/db.sqlite"),
logger: logger
)
let client = SQLiteClient(configuration: configuration)
let database = SQLiteDatabaseClient(
client: client,
logger: logger
)
try await client.run()
let result = try await database.withConnection { connection in
try await connection.run(
query: #"""
SELECT
sqlite_version() AS "version"
WHERE
1=\#(1);
"""#
)
}
for try await item in result {
let version = try item.decode(column: "version", as: String.self)
print(version)
}
await client.shutdown()
```
> [!WARNING]
> This repository is a work in progress, things can break until it reaches v1.0.0.
## Other database drivers
The following database driver implementations are available for use:
- [Postgres](https://github.com/feather-framework/feather-postgres-database)
- [MySQL](https://github.com/feather-framework/feather-mysql-database)
## Development
- Build: `swift build`
- Test:
- local: `swift test`
- using Docker: `make docker-test`
- Format: `make format`
- Check: `make check`
## Contributing
[Pull requests](https://github.com/feather-framework/feather-sqlite-database/pulls) are welcome. Please keep changes focused and include tests for new logic.