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
33 changes: 33 additions & 0 deletions Plugins/TableProPluginKit/PluginConcurrencySupport.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Foundation

public func pluginDispatchAsync<T: Sendable>(
on queue: DispatchQueue,
execute work: @escaping @Sendable () throws -> T
) async throws -> T {
try await withCheckedThrowingContinuation { continuation in
queue.async {
do {
let result = try work()
continuation.resume(returning: result)
} catch {
continuation.resume(throwing: error)
}
}
}
}

public func pluginDispatchAsync(
on queue: DispatchQueue,
execute work: @escaping @Sendable () throws -> Void
) async throws {
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in
queue.async {
do {
try work()
continuation.resume()
} catch {
continuation.resume(throwing: error)
}
}
}
}
19 changes: 19 additions & 0 deletions Plugins/TableProPluginKit/PluginDriverError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// PluginDriverError.swift
// TableProPluginKit
//

import Foundation

public protocol PluginDriverError: LocalizedError, Sendable {
var pluginErrorMessage: String { get }
var pluginErrorCode: Int? { get }
var pluginSqlState: String? { get }
var pluginErrorDetail: String? { get }
}

public extension PluginDriverError {
var pluginErrorCode: Int? { nil }
var pluginSqlState: String? { nil }
var pluginErrorDetail: String? { nil }
}
5 changes: 5 additions & 0 deletions Plugins/TableProPluginKit/PluginRowLimits.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public enum PluginRowLimits {
public static let defaultMax = 100_000
}