Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 75004d9

Browse files
authored
Update required versions of dependencies (vapor#265)
Update required versions of dependencies. Remove unneeded dependency on SwiftAtomics. Tiny bit of cleanup.
1 parent ad8ae1e commit 75004d9

File tree

4 files changed

+10
-25
lines changed

4 files changed

+10
-25
lines changed

‎Package.swift‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ let package = Package(
1313
.library(name: "PostgresKit", targets: ["PostgresKit"]),
1414
],
1515
dependencies: [
16-
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.20.2"),
17-
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.28.0"),
16+
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.21.1"),
17+
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.29.3"),
1818
.package(url: "https://github.com/vapor/async-kit.git", from: "1.19.0"),
19-
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.2.0")
2019
],
2120
targets: [
2221
.target(
@@ -25,7 +24,6 @@ let package = Package(
2524
.product(name: "AsyncKit", package: "async-kit"),
2625
.product(name: "PostgresNIO", package: "postgres-nio"),
2726
.product(name: "SQLKit", package: "sql-kit"),
28-
.product(name: "Atomics", package: "swift-atomics"),
2927
],
3028
swiftSettings: swiftSettings
3129
),
@@ -43,7 +41,4 @@ let package = Package(
4341
var swiftSettings: [SwiftSetting] { [
4442
.enableUpcomingFeature("ConciseMagicFile"),
4543
.enableUpcomingFeature("ForwardTrailingClosures"),
46-
.enableUpcomingFeature("DisableOutwardActorInference"),
47-
.enableUpcomingFeature("StrictConcurrency"),
48-
.enableExperimentalFeature("StrictConcurrency=complete"),
4944
] }

‎Package@swift-5.9.swift‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ let package = Package(
1616
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.20.2"),
1717
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.28.0"),
1818
.package(url: "https://github.com/vapor/async-kit.git", from: "1.19.0"),
19-
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.2.0")
2019
],
2120
targets: [
2221
.target(
@@ -25,7 +24,6 @@ let package = Package(
2524
.product(name: "AsyncKit", package: "async-kit"),
2625
.product(name: "PostgresNIO", package: "postgres-nio"),
2726
.product(name: "SQLKit", package: "sql-kit"),
28-
.product(name: "Atomics", package: "swift-atomics"),
2927
],
3028
swiftSettings: swiftSettings
3129
),
@@ -45,6 +43,5 @@ var swiftSettings: [SwiftSetting] { [
4543
.enableUpcomingFeature("ConciseMagicFile"),
4644
.enableUpcomingFeature("ForwardTrailingClosures"),
4745
.enableUpcomingFeature("DisableOutwardActorInference"),
48-
.enableUpcomingFeature("StrictConcurrency"),
4946
.enableExperimentalFeature("StrictConcurrency=complete"),
5047
] }

‎Sources/PostgresKit/PostgresConnectionSource.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import NIOSSL
2-
import Atomics
2+
import NIOConcurrencyHelpers
33
import AsyncKit
44
import Logging
55
import PostgresNIO
@@ -9,7 +9,7 @@ import NIOCore
99
public struct PostgresConnectionSource: ConnectionPoolSource {
1010
public let sqlConfiguration: SQLPostgresConfiguration
1111

12-
private static let idGenerator = ManagedAtomic<Int>(0)
12+
private static let idGenerator = NIOLockedValueBox<Int>(0)
1313

1414
public init(sqlConfiguration: SQLPostgresConfiguration) {
1515
self.sqlConfiguration = sqlConfiguration
@@ -22,7 +22,7 @@ public struct PostgresConnectionSource: ConnectionPoolSource {
2222
let connectionFuture = PostgresConnection.connect(
2323
on: eventLoop,
2424
configuration: self.sqlConfiguration.coreConfiguration,
25-
id: Self.idGenerator.wrappingIncrementThenLoad(ordering:.relaxed),
25+
id: Self.idGenerator.withLockedValue{ 0ドル +=1; return 0ドル },
2626
logger: logger
2727
)
2828

‎Sources/PostgresKit/PostgresDatabase+SQL.swift‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,18 @@ extension PostgresDatabase {
1313
decodingContext: PostgresDecodingContext<some PostgresJSONDecoder>,
1414
queryLogLevel: Logger.Level? = .debug
1515
) -> some SQLDatabase {
16-
_PostgresSQLDatabase(database: self, encodingContext: encodingContext, decodingContext: decodingContext, queryLogLevel: queryLogLevel)
16+
PostgresSQLDatabase(database: self, encodingContext: encodingContext, decodingContext: decodingContext, queryLogLevel: queryLogLevel)
1717
}
1818
}
1919

20-
private struct _PostgresSQLDatabase<PDatabase: PostgresDatabase, E: PostgresJSONEncoder, D: PostgresJSONDecoder> {
20+
private struct PostgresSQLDatabase<PDatabase: PostgresDatabase, E: PostgresJSONEncoder, D: PostgresJSONDecoder> {
2121
let database: PDatabase
2222
let encodingContext: PostgresEncodingContext<E>
2323
let decodingContext: PostgresDecodingContext<D>
2424
let queryLogLevel: Logger.Level?
25-
26-
init(database: PDatabase, encodingContext: PostgresEncodingContext<E>, decodingContext: PostgresDecodingContext<D>, queryLogLevel: Logger.Level?) {
27-
self.database = database
28-
self.encodingContext = encodingContext
29-
self.decodingContext = decodingContext
30-
self.queryLogLevel = queryLogLevel
31-
}
3225
}
3326

34-
extension _PostgresSQLDatabase: SQLDatabase, PostgresDatabase {
27+
extension PostgresSQLDatabase: SQLDatabase, PostgresDatabase {
3528
var logger: Logger {
3629
self.database.logger
3730
}
@@ -51,7 +44,7 @@ extension _PostgresSQLDatabase: SQLDatabase, PostgresDatabase {
5144
func execute(sql query: any SQLExpression, _ onRow: @escaping @Sendable (any SQLRow) -> ()) -> EventLoopFuture<Void> {
5245
let (sql, binds) = self.serialize(query)
5346

54-
if let queryLogLevel {
47+
if let queryLogLevel =self.queryLogLevel {
5548
self.logger.log(level: queryLogLevel, "\(sql) [\(binds)]")
5649
}
5750
return self.eventLoop.makeCompletedFuture {
@@ -75,7 +68,7 @@ extension _PostgresSQLDatabase: SQLDatabase, PostgresDatabase {
7568
) async throws {
7669
let (sql, binds) = self.serialize(query)
7770

78-
if let queryLogLevel {
71+
if let queryLogLevel =self.queryLogLevel {
7972
self.logger.log(level: queryLogLevel, "\(sql) [\(binds)]")
8073
}
8174

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /