LocalData/Sources/LocalData/Protocols/TransformingMigration.swift
Matt Bruce f3f42c7844 Update Audit, Helpers, Migrations (+4 more)
Summary:
- Sources: Audit, Helpers, Migrations, Models, Protocols (+2 more)

Stats:
- 27 files changed, 303 insertions(+), 12 deletions(-)
2026-01-18 14:53:31 -06:00

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
}