Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ test:
swift test --parallel

docker-test:
docker build -t feather-mysql-database-tests . -f ./docker/tests/Dockerfile && docker run --rm feather-mysql-database-tests
docker build -t feather-database-mysql-tests . -f ./docker/tests/Dockerfile && docker run --rm feather-database-mysql-tests
12 changes: 6 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var defaultSwiftSettings: [SwiftSetting] =
// https://forums.swift.org/t/experimental-support-for-lifetime-dependencies-in-swift-6-2-and-beyond/78638
.enableExperimentalFeature("Lifetimes"),
// https://github.com/swiftlang/swift/pull/65218
.enableExperimentalFeature("AvailabilityMacro=featherMySQLDatabase 1.0:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
.enableExperimentalFeature("AvailabilityMacro=FeatherDatabaseMySQL 1.0:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
]

#if compiler(>=6.2)
Expand All @@ -23,7 +23,7 @@ defaultSwiftSettings.append(


let package = Package(
name: "feather-mysql-database",
name: "feather-database-mysql",
platforms: [
.macOS(.v15),
.iOS(.v18),
Expand All @@ -32,7 +32,7 @@ let package = Package(
.visionOS(.v2),
],
products: [
.library(name: "FeatherMySQLDatabase", targets: ["FeatherMySQLDatabase"]),
.library(name: "FeatherDatabaseMySQL", targets: ["FeatherDatabaseMySQL"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-log", from: "1.6.0"),
Expand All @@ -42,7 +42,7 @@ let package = Package(
],
targets: [
.target(
name: "FeatherMySQLDatabase",
name: "FeatherDatabaseMySQL",
dependencies: [
.product(name: "Logging", package: "swift-log"),
.product(name: "MySQLNIO", package: "mysql-nio"),
Expand All @@ -51,9 +51,9 @@ let package = Package(
swiftSettings: defaultSwiftSettings
),
.testTarget(
name: "FeatherMySQLDatabaseTests",
name: "FeatherDatabaseMySQLTests",
dependencies: [
.target(name: "FeatherMySQLDatabase"),
.target(name: "FeatherDatabaseMySQL"),
],
swiftSettings: defaultSwiftSettings
),
Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Feather MySQL Database
# Feather Database MySQL

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

[
![Release: 1.0.0-beta.4](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E4-F05138)
![Release: 1.0.0-beta.5](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E5-F05138)
](
https://github.com/feather-framework/feather-mysql-database/releases/tag/1.0.0-beta.4
https://github.com/feather-framework/feather-database-mysql/releases/tag/1.0.0-beta.5
)

## Features
Expand Down Expand Up @@ -36,20 +36,24 @@ MySQL/MariaDB driver implementation for the abstract [Feather Database](https://
Add the dependency to your `Package.swift`:

```swift
.package(url: "https://github.com/feather-framework/feather-mysql-database", exact: "1.0.0-beta.4"),
.package(url: "https://github.com/feather-framework/feather-database-mysql", exact: "1.0.0-beta.5"),
```

Then add `FeatherMySQLDatabase` to your target dependencies:
Then add `FeatherDatabaseMySQL` to your target dependencies:

```swift
.product(name: "FeatherMySQLDatabase", package: "feather-mysql-database"),
.product(name: "FeatherDatabaseMySQL", package: "feather-database-mysql"),
```

## Usage

API documentation is available at the link below:

[![DocC API documentation](https://img.shields.io/badge/DocC-API_documentation-F05138)](https://feather-framework.github.io/feather-mysql-database/)
[
![DocC API documentation](https://img.shields.io/badge/DocC-API_documentation-F05138)
](
https://feather-framework.github.io/feather-database-mysql/
)

Here is a brief example:

Expand All @@ -60,7 +64,7 @@ import NIOCore
import NIOPosix
import NIOSSL
import FeatherDatabase
import FeatherMySQLDatabase
import FeatherDatabaseMySQL

var logger = Logger(label: "example")
logger.logLevel = .info
Expand All @@ -85,7 +89,7 @@ let connection =
)
.get()

let database = MySQLDatabaseClient(
let database = DatabaseClientMySQL(
connection: connection,
logger: logger
)
Expand Down Expand Up @@ -123,10 +127,10 @@ catch {

## Other database drivers

The following database driver implementations are available for use:
The following database client implementations are also available for use:

- [SQLite](https://github.com/feather-framework/feather-sqlite-database)
- [Postgres](https://github.com/feather-framework/feather-postgres-database)
- [SQLite](https://github.com/feather-framework/feather-database-sqlite)
- [Postgres](https://github.com/feather-framework/feather-database-postgres)

## Development

Expand All @@ -139,4 +143,5 @@ The following database driver implementations are available for use:

## Contributing

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

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// MySQLDatabaseClient.swift
// feather-mysql-database
// DatabaseClientMySQL.swift
// feather-database-mysql
//
// Created by Tibor Bödecs on 2026. 01. 10..
//
Expand All @@ -12,11 +12,11 @@ import MySQLNIO
/// A MySQL-backed database client.
///
/// Use this client to execute queries and manage transactions on MySQL.
public struct MySQLDatabaseClient: DatabaseClient {
public struct DatabaseClientMySQL: DatabaseClient {

public typealias Connection = MySQLDatabaseConnection
public typealias Connection = DatabaseConnectionMySQL

var connection: MySQLDatabaseConnection
var connection: DatabaseConnectionMySQL
var logger: Logger

/// Create a MySQL database client.
Expand Down Expand Up @@ -75,7 +75,7 @@ public struct MySQLDatabaseClient: DatabaseClient {
}
catch {
throw DatabaseError.transaction(
MySQLTransactionError(
DatabaseTransactionErrorMySQL(
beginError: error
)
)
Expand All @@ -92,14 +92,14 @@ public struct MySQLDatabaseClient: DatabaseClient {
}
catch {
throw DatabaseError.transaction(
MySQLTransactionError(commitError: error)
DatabaseTransactionErrorMySQL(commitError: error)
)
}

return result
}
catch {
var txError = MySQLTransactionError()
var txError = DatabaseTransactionErrorMySQL()

if !closureHasFinished {
txError.closureError = error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// MySQLDatabaseConnection.swift
// feather-mysql-database
// DatabaseConnectionMySQL.swift
// feather-database-mysql
//
// Created by Tibor Bödecs on 2026. 01. 10.
//
Expand Down Expand Up @@ -45,9 +45,9 @@ extension DatabaseQuery {
}
}

public struct MySQLDatabaseConnection: DatabaseConnection, Sendable {
public struct DatabaseConnectionMySQL: DatabaseConnection {

public typealias RowSequence = MySQLRowSequence
public typealias RowSequence = DatabaseRowSequenceMySQL

let connection: MySQLNIO.MySQLConnection
public var logger: Logging.Logger
Expand Down Expand Up @@ -75,7 +75,7 @@ public struct MySQLDatabaseConnection: DatabaseConnection, Sendable {
.get()

return try await handler(
MySQLRowSequence(
DatabaseRowSequenceMySQL(
elements: rows.map {
.init(
row: $0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// MySQLDatabaseRow.swift
// feather-mysql-database
// DatabaseRowMySQL.swift
// feather-database-mysql
//
// Created by Tibor Bödecs on 2026. 01. 10.
//

import FeatherDatabase
import MySQLNIO

public struct MySQLRow: DatabaseRow {
public struct DatabaseRowMySQL: DatabaseRow {

var row: MySQLNIO.MySQLRow

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// MySQLDatabaseRowSequence.swift
// feather-mysql-database
// DatabaseRowSequenceMySQL.swift
// feather-database-mysql
//
// Created by Tibor Bödecs on 2026. 01. 10.
//
Expand All @@ -10,22 +10,22 @@ import FeatherDatabase
/// A query result backed by MySQL rows.
///
/// Use this type to iterate or collect MySQL query results.
public struct MySQLRowSequence: DatabaseRowSequence {
public struct DatabaseRowSequenceMySQL: DatabaseRowSequence {

let elements: [MySQLRow]
let elements: [DatabaseRowMySQL]

/// An async iterator over MySQL rows.
///
/// This iterator traverses the in-memory row list.
public struct Iterator: AsyncIteratorProtocol {
var index = 0
let elements: [MySQLRow]
let elements: [DatabaseRowMySQL]

/// Return the next row in the sequence.
///
/// This returns `nil` after the last row.
/// - Returns: The next `MySQLRow`, or `nil` when finished.
public mutating func next() async -> MySQLRow? {
public mutating func next() async -> DatabaseRowMySQL? {
guard index < elements.count else {
return nil
}
Expand All @@ -47,7 +47,7 @@ public struct MySQLRowSequence: DatabaseRowSequence {
/// This returns the rows held by the result.
/// - Throws: An error if collection fails.
/// - Returns: An array of `MySQLRow` values.
public func collect() async throws -> [MySQLRow] {
public func collect() async throws -> [DatabaseRowMySQL] {
elements
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// MySQLDatabaseTransactionError.swift
// feather-mysql-database
// DatabaseTransactionErrorMySQL.swift
// feather-database-mysql
//
// Created by Tibor Bödecs on 2026. 01. 10.
//
Expand All @@ -10,7 +10,7 @@ import FeatherDatabase
/// Transaction error details for MySQL operations.
///
/// Use this to capture errors from transaction phases.
public struct MySQLTransactionError: DatabaseTransactionError {
public struct DatabaseTransactionErrorMySQL: DatabaseTransactionError {

/// The source file where the error was created.
///
Expand Down
Loading