CustomMapping
public enum CustomMapping : Hashable
Provides the type of mapping for an entity. Mappings of entities with no CustomMapping provided will be automatically calculated if possible. Any conflicts or ambiguity will raise an assertion.
-
The
sourceEntityis meant to be removed from the sourceDynamicSchemaand should not be migrated to the destinationDynamicSchema.Declaration
Swift
case deleteEntity(sourceEntity: EntityName) -
The
destinationEntityis newly added to the destinationDynamicSchemaand has no mapping from the sourceDynamicSchema.Declaration
Swift
case insertEntity(destinationEntity: EntityName) -
The
DynamicSchemas entity has no changes and can be copied directly fromsourceEntitytodestinationEntity.Declaration
Swift
case copyEntity(sourceEntity: EntityName, destinationEntity: EntityName) -
The
DynamicSchemas entity needs transformations fromsourceEntitytodestinationEntity. Thetransformerclosure will be used to apply the changes. TheCustomMapping.inferredTransformationmethod can be used directly as thetransformerif the changes can be inferred (i.e. lightweight).Declaration
Swift
case transformEntity(sourceEntity: EntityName, destinationEntity: EntityName, transformer: Transformer) -
The closure type for
CustomMapping.transformEntity.Declaration
Swift
public typealias Transformer = (_ sourceObject: UnsafeSourceObject, _ createDestinationObject: () -> UnsafeDestinationObject) throws -> VoidParameters
sourceObjecta proxy object representing the source entity. The properties can be accessed via keyPath.
createDestinationObjectthe closure to create the object for the destination entity. The
CustomMapping.inferredTransformationmethod can be used directly as thetransformerif the changes can be inferred (i.e. lightweight). The object is created lazily and executing the closure multiple times will return the same instance. The destination object’s properties can be accessed and updated via keyPath. -
The
CustomMapping.inferredTransformationmethod can be used directly as thetransformerif the changes can be inferred (i.e. lightweight).Declaration
Swift
public static func inferredTransformation(_ sourceObject: UnsafeSourceObject, _ createDestinationObject: () -> UnsafeDestinationObject) throws
-
Declaration
Swift
public static func == (lhs: CustomMapping, rhs: CustomMapping) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
View on GitHub
CustomMapping Enumeration Reference