Summary: - Sources: Audit, Helpers, Migrations, Models, Protocols (+2 more) Stats: - 27 files changed, 303 insertions(+), 12 deletions(-)
16 lines
633 B
Swift
16 lines
633 B
Swift
import Foundation
|
|
|
|
/// Migration protocol that transforms a source value into a destination value.
|
|
public protocol TransformingMigration: StorageMigration {
|
|
/// The value type stored at the source key.
|
|
associatedtype SourceValue: Codable & Sendable
|
|
|
|
/// The source key to read from during migration.
|
|
var sourceKey: StorageKey<SourceValue> { get }
|
|
/// Transforms a source value into the destination value type.
|
|
///
|
|
/// - Parameter source: The value read from ``sourceKey``.
|
|
/// - Returns: The transformed value for the destination key.
|
|
func transform(_ source: SourceValue) async throws -> Value
|
|
}
|