From 7da5172ecb4a88bb809c11c626a890989516b3f6 Mon Sep 17 00:00:00 2001 From: Tibor Bodecs Date: Thu, 19 Feb 2026 10:36:01 +0100 Subject: [PATCH] apply naming conventions --- Makefile | 2 +- Package.swift | 12 ++++---- README.md | 28 ++++++++++++------- .../DatabaseClientPostgres.swift} | 14 +++++----- .../DatabaseConnectionPostgres.swift} | 10 +++---- .../DatabaseRowPostgres.swift} | 6 ++-- .../DatabaseRowSequencePostgres.swift} | 12 ++++---- .../DatabaseTransactionErrorPostgres.swift} | 6 ++-- .../FeatherDatabasePostgresTestSuite.swift} | 12 ++++---- 9 files changed, 55 insertions(+), 47 deletions(-) rename Sources/{FeatherPostgresDatabase/PostgresDatabaseClient.swift => FeatherDatabasePostgres/DatabaseClientPostgres.swift} (87%) rename Sources/{FeatherPostgresDatabase/PostgresDatabaseConnection.swift => FeatherDatabasePostgres/DatabaseConnectionPostgres.swift} (89%) rename Sources/{FeatherPostgresDatabase/PostgresDatabaseRow.swift => FeatherDatabasePostgres/DatabaseRowPostgres.swift} (94%) rename Sources/{FeatherPostgresDatabase/PostgresDatabaseRowSequence.swift => FeatherDatabasePostgres/DatabaseRowSequencePostgres.swift} (86%) rename Sources/{FeatherPostgresDatabase/PostgresDatabaseTransactionError.swift => FeatherDatabasePostgres/DatabaseTransactionErrorPostgres.swift} (82%) rename Tests/{FeatherPostgresDatabaseTests/FeatherPostgresDatabaseTestSuite.swift => FeatherDatabasePostgresTests/FeatherDatabasePostgresTestSuite.swift} (99%) diff --git a/Makefile b/Makefile index a365586..451dc41 100644 --- a/Makefile +++ b/Makefile @@ -47,4 +47,4 @@ test: swift test --parallel docker-test: - docker build -t feather-postgres-database-tests . -f ./docker/tests/Dockerfile && docker run --rm feather-postgres-database-tests + docker build -t feather-database-postgres-tests . -f ./docker/tests/Dockerfile && docker run --rm feather-database-postgres-tests diff --git a/Package.swift b/Package.swift index 1006681..22d4dd7 100644 --- a/Package.swift +++ b/Package.swift @@ -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=featherPostgresDatabase 1.0:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"), + .enableExperimentalFeature("AvailabilityMacro=FeatherDatabasePostgres 1.0:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"), ] #if compiler(>=6.2) @@ -23,7 +23,7 @@ defaultSwiftSettings.append( let package = Package( - name: "feather-postgres-database", + name: "feather-database-postgres", platforms: [ .macOS(.v15), .iOS(.v18), @@ -32,7 +32,7 @@ let package = Package( .visionOS(.v2), ], products: [ - .library(name: "FeatherPostgresDatabase", targets: ["FeatherPostgresDatabase"]), + .library(name: "FeatherDatabasePostgres", targets: ["FeatherDatabasePostgres"]), ], dependencies: [ .package(url: "https://github.com/apple/swift-log", from: "1.6.0"), @@ -42,7 +42,7 @@ let package = Package( ], targets: [ .target( - name: "FeatherPostgresDatabase", + name: "FeatherDatabasePostgres", dependencies: [ .product(name: "Logging", package: "swift-log"), .product(name: "PostgresNIO", package: "postgres-nio"), @@ -51,9 +51,9 @@ let package = Package( swiftSettings: defaultSwiftSettings ), .testTarget( - name: "FeatherPostgresDatabaseTests", + name: "FeatherDatabasePostgresTests", dependencies: [ - .target(name: "FeatherPostgresDatabase"), + .target(name: "FeatherDatabasePostgres"), ], swiftSettings: defaultSwiftSettings ), diff --git a/README.md b/README.md index d730955..a5d3fee 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ -# Feather Postgres Database +# Feather Database Postgres Postgres 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)](https://github.com/feather-framework/feather-postgres-database/releases/tag/1.0.0-beta.4) +[ + ![Release: 1.0.0-beta.5](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E5-F05138) +]( + https://github.com/feather-framework/feather-database-postgres/releases/tag/1.0.0-beta.5 +) ## Features @@ -33,20 +37,24 @@ Postgres driver implementation for the abstract [Feather Database](https://githu Add the dependency to your `Package.swift`: ```swift -.package(url: "https://github.com/feather-framework/feather-postgres-database", exact: "1.0.0-beta.4"), +.package(url: "https://github.com/feather-framework/feather-database-postgres", exact: "1.0.0-beta.5"), ``` -Then add `FeatherPostgresDatabase` to your target dependencies: +Then add `FeatherDatabasePostgres` to your target dependencies: ```swift -.product(name: "FeatherPostgresDatabase", package: "feather-postgres-database"), +.product(name: "FeatherDatabasePostgres", package: "feather-database-postgres"), ``` ## 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-postgres-database/) +[ + ![DocC API documentation](https://img.shields.io/badge/DocC-API_documentation-F05138) +]( + https://feather-framework.github.io/feather-database-postgres/ +) Here is a brief example: @@ -55,7 +63,7 @@ import Logging import NIOSSL import PostgresNIO import FeatherDatabase -import FeatherPostgresDatabase +import FeatherDatabasePostgres var logger = Logger(label: "example") logger.logLevel = .info @@ -118,8 +126,8 @@ try await withThrowingTaskGroup(of: Void.self) { group in The following database driver implementations are available for use: -- [SQLite](https://github.com/feather-framework/feather-sqlite-database) -- [MySQL](https://github.com/feather-framework/feather-mysql-database) +- [SQLite](https://github.com/feather-framework/feather-database-sqlite) +- [MySQL](https://github.com/feather-framework/feather-database-mysql) ## Development @@ -132,4 +140,4 @@ The following database driver implementations are available for use: ## Contributing -[Pull requests](https://github.com/feather-framework/feather-postgres-database/pulls) are welcome. Please keep changes focused and include tests for new logic. +[Pull requests](https://github.com/feather-framework/feather-database-postgres/pulls) are welcome. Please keep changes focused and include tests for new logic. diff --git a/Sources/FeatherPostgresDatabase/PostgresDatabaseClient.swift b/Sources/FeatherDatabasePostgres/DatabaseClientPostgres.swift similarity index 87% rename from Sources/FeatherPostgresDatabase/PostgresDatabaseClient.swift rename to Sources/FeatherDatabasePostgres/DatabaseClientPostgres.swift index 8004f38..3bde7dd 100644 --- a/Sources/FeatherPostgresDatabase/PostgresDatabaseClient.swift +++ b/Sources/FeatherDatabasePostgres/DatabaseClientPostgres.swift @@ -1,6 +1,6 @@ // -// PostgresDatabaseClient.swift -// feather-postgres-database +// DatabaseClientPostgres.swift +// feather-database-postgres // // Created by Tibor Bödecs on 2026. 01. 10.. // @@ -12,8 +12,8 @@ import PostgresNIO /// A Postgres-backed database client. /// /// Use this client to execute queries and manage transactions on Postgres. -public struct PostgresDatabaseClient: DatabaseClient { - public typealias Connection = PostgresDatabaseConnection +public struct DatabaseClientPostgres: DatabaseClient { + public typealias Connection = DatabaseConnectionPostgres var client: PostgresNIO.PostgresClient var logger: Logger @@ -46,7 +46,7 @@ public struct PostgresDatabaseClient: DatabaseClient { ) async throws(DatabaseError) -> T { do { return try await client.withConnection { connection in - let databaseConnection = PostgresDatabaseConnection( + let databaseConnection = DatabaseConnectionPostgres( connection: connection, logger: logger ) @@ -75,7 +75,7 @@ public struct PostgresDatabaseClient: DatabaseClient { return try await client.withTransaction( logger: logger ) { connection in - let databaseConnection = PostgresDatabaseConnection( + let databaseConnection = DatabaseConnectionPostgres( connection: connection, logger: logger ) @@ -84,7 +84,7 @@ public struct PostgresDatabaseClient: DatabaseClient { } catch let error as PostgresTransactionError { throw .transaction( - PostgresDatabaseTransactionError( + DatabaseTransactionErrorPostgres( underlyingError: error ) ) diff --git a/Sources/FeatherPostgresDatabase/PostgresDatabaseConnection.swift b/Sources/FeatherDatabasePostgres/DatabaseConnectionPostgres.swift similarity index 89% rename from Sources/FeatherPostgresDatabase/PostgresDatabaseConnection.swift rename to Sources/FeatherDatabasePostgres/DatabaseConnectionPostgres.swift index e3b3aab..40e2e8b 100644 --- a/Sources/FeatherPostgresDatabase/PostgresDatabaseConnection.swift +++ b/Sources/FeatherDatabasePostgres/DatabaseConnectionPostgres.swift @@ -1,6 +1,6 @@ // -// PostgresDatabaseConnection.swift -// feather-postgres-database +// DatabaseConnectionPostgres.swift +// feather-database-postgres // // Created by Tibor Bödecs on 2026. 01. 10. // @@ -40,9 +40,9 @@ extension DatabaseQuery { } } -public struct PostgresDatabaseConnection: DatabaseConnection { +public struct DatabaseConnectionPostgres: DatabaseConnection { - public typealias RowSequence = PostgresDatabaseRowSequence + public typealias RowSequence = DatabaseRowSequencePostgres var connection: PostgresConnection public var logger: Logger @@ -67,7 +67,7 @@ public struct PostgresDatabaseConnection: DatabaseConnection { ) return try await handler( - PostgresDatabaseRowSequence( + DatabaseRowSequencePostgres( backingSequence: sequence ) ) diff --git a/Sources/FeatherPostgresDatabase/PostgresDatabaseRow.swift b/Sources/FeatherDatabasePostgres/DatabaseRowPostgres.swift similarity index 94% rename from Sources/FeatherPostgresDatabase/PostgresDatabaseRow.swift rename to Sources/FeatherDatabasePostgres/DatabaseRowPostgres.swift index 48faf91..538913f 100644 --- a/Sources/FeatherPostgresDatabase/PostgresDatabaseRow.swift +++ b/Sources/FeatherDatabasePostgres/DatabaseRowPostgres.swift @@ -1,6 +1,6 @@ // -// PostgresDatabaseRow.swift -// feather-postgres-database +// DatabaseRowPostgres.swift +// feather-database-postgres // // Created by Tibor Bödecs on 2026. 01. 10. // @@ -8,7 +8,7 @@ import FeatherDatabase import PostgresNIO -public struct PostgresDatabaseRow: DatabaseRow { +public struct DatabaseRowPostgres: DatabaseRow { var row: PostgresRow diff --git a/Sources/FeatherPostgresDatabase/PostgresDatabaseRowSequence.swift b/Sources/FeatherDatabasePostgres/DatabaseRowSequencePostgres.swift similarity index 86% rename from Sources/FeatherPostgresDatabase/PostgresDatabaseRowSequence.swift rename to Sources/FeatherDatabasePostgres/DatabaseRowSequencePostgres.swift index 7212077..310679e 100644 --- a/Sources/FeatherPostgresDatabase/PostgresDatabaseRowSequence.swift +++ b/Sources/FeatherDatabasePostgres/DatabaseRowSequencePostgres.swift @@ -1,6 +1,6 @@ // -// PostgresDatabaseRowSequence.swift -// feather-postgres-database +// DatabaseRowSequencePostgres.swift +// feather-database-postgres // // Created by Tibor Bödecs on 2026. 01. 10. // @@ -11,7 +11,7 @@ import PostgresNIO /// A query result backed by a Postgres row sequence. /// /// Use this type to iterate or collect Postgres query results. -public struct PostgresDatabaseRowSequence: DatabaseRowSequence { +public struct DatabaseRowSequencePostgres: DatabaseRowSequence { var backingSequence: PostgresRowSequence @@ -28,7 +28,7 @@ public struct PostgresDatabaseRowSequence: DatabaseRowSequence { /// - Returns: The next `PostgresRow`, or `nil` when finished. #if compiler(>=6.2) @concurrent - public mutating func next() async throws -> PostgresDatabaseRow? { + public mutating func next() async throws -> DatabaseRowPostgres? { guard !Task.isCancelled else { return nil } @@ -65,8 +65,8 @@ public struct PostgresDatabaseRowSequence: DatabaseRowSequence { /// This consumes the sequence and returns all rows. /// - Throws: An error if iteration fails. /// - Returns: An array of `PostgresRow` values. - public func collect() async throws -> [PostgresDatabaseRow] { - var items: [PostgresDatabaseRow] = [] + public func collect() async throws -> [DatabaseRowPostgres] { + var items: [DatabaseRowPostgres] = [] for try await item in self { items.append(item) } diff --git a/Sources/FeatherPostgresDatabase/PostgresDatabaseTransactionError.swift b/Sources/FeatherDatabasePostgres/DatabaseTransactionErrorPostgres.swift similarity index 82% rename from Sources/FeatherPostgresDatabase/PostgresDatabaseTransactionError.swift rename to Sources/FeatherDatabasePostgres/DatabaseTransactionErrorPostgres.swift index a4caf93..ab96c35 100644 --- a/Sources/FeatherPostgresDatabase/PostgresDatabaseTransactionError.swift +++ b/Sources/FeatherDatabasePostgres/DatabaseTransactionErrorPostgres.swift @@ -1,6 +1,6 @@ // -// PostgresDatabaseTransactionError.swift -// feather-postgres-database +// DatabaseTransactionErrorPostgres.swift +// feather-database-postgres // // Created by Tibor Bödecs on 2026. 02. 02.. // @@ -8,7 +8,7 @@ import FeatherDatabase import PostgresNIO -public struct PostgresDatabaseTransactionError: DatabaseTransactionError { +public struct DatabaseTransactionErrorPostgres: DatabaseTransactionError { var underlyingError: PostgresTransactionError diff --git a/Tests/FeatherPostgresDatabaseTests/FeatherPostgresDatabaseTestSuite.swift b/Tests/FeatherDatabasePostgresTests/FeatherDatabasePostgresTestSuite.swift similarity index 99% rename from Tests/FeatherPostgresDatabaseTests/FeatherPostgresDatabaseTestSuite.swift rename to Tests/FeatherDatabasePostgresTests/FeatherDatabasePostgresTestSuite.swift index bf0330e..6d43b96 100644 --- a/Tests/FeatherPostgresDatabaseTests/FeatherPostgresDatabaseTestSuite.swift +++ b/Tests/FeatherDatabasePostgresTests/FeatherDatabasePostgresTestSuite.swift @@ -1,6 +1,6 @@ // -// FeatherPostgresDatabaseTestSuite.swift -// feather-postgres-database +// FeatherDatabasePostgresTestSuite.swift +// feather-database-postgres // // Created by Tibor Bödecs on 2026. 01. 10.. // @@ -11,7 +11,7 @@ import NIOSSL import PostgresNIO import Testing -@testable import FeatherPostgresDatabase +@testable import FeatherDatabasePostgres #if canImport(FoundationEssentials) import FoundationEssentials @@ -20,7 +20,7 @@ import Foundation #endif @Suite -struct FeatherPostgresDatabaseTestSuite { +struct FeatherDatabasePostgresTestSuite { private func randomTableSuffix() -> String { let characters = Array("abcdefghijklmnopqrstuvwxyz0123456789") @@ -34,7 +34,7 @@ struct FeatherPostgresDatabaseTestSuite { private func runUsingTestDatabaseClient( _ closure: - @escaping (@Sendable (PostgresDatabaseClient) async throws -> Void) + @escaping (@Sendable (DatabaseClientPostgres) async throws -> Void) ) async throws { var logger = Logger(label: "test") logger.logLevel = .info @@ -66,7 +66,7 @@ struct FeatherPostgresDatabaseTestSuite { backgroundLogger: logger ) - let database = PostgresDatabaseClient( + let database = DatabaseClientPostgres( client: client, logger: logger )