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 sourceEntity is meant to be removed from the source DynamicSchema and should not be migrated to the destination DynamicSchema.

    Declaration

    Swift

    case deleteEntity(sourceEntity: EntityName)
  • The destinationEntity is newly added to the destination DynamicSchema and has no mapping from the source DynamicSchema.

    Declaration

    Swift

    case insertEntity(destinationEntity: EntityName)
  • The DynamicSchemas entity has no changes and can be copied directly from sourceEntity to destinationEntity.

    Declaration

    Swift

    case copyEntity(sourceEntity: EntityName, destinationEntity: EntityName)
  • The DynamicSchemas entity needs transformations from sourceEntity to destinationEntity. The transformer closure will be used to apply the changes. The CustomMapping.inferredTransformation method can be used directly as the transformer if 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 -> Void

    Parameters

    sourceObject

    a proxy object representing the source entity. The properties can be accessed via keyPath.

    createDestinationObject

    the closure to create the object for the destination entity. The CustomMapping.inferredTransformation method can be used directly as the transformer if 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.inferredTransformation method can be used directly as the transformer if the changes can be inferred (i.e. lightweight).

    Declaration

    Swift

    public static func inferredTransformation(_ sourceObject: UnsafeSourceObject, _ createDestinationObject: () -> UnsafeDestinationObject) throws

Equatable

  • Declaration

    Swift

    public static func == (lhs: CustomMapping, rhs: CustomMapping) -> Bool

Hashable

  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)