Avatar
@swift-5.6.3 class EventLoopFuture<T> { func get() async throws -> T { fatalError() } } struct Database { func transaction<T>(_ closure: @escaping (Database) -> EventLoopFuture<T>) -> EventLoopFuture<T> { closure(self) } } extension Database { func transaction<T>(_ closure: @Sendable @escaping (Database) async throws -> T) async throws -> T { try await self.transaction { db -> EventLoopFuture<T> in fatalError() }.get() } } (edited)