Transformer

public protocol Transformer

A protocol that indicates a type that can perform transformations of values.

  • The value that the transformer accepts as an input.

    Declaration

    Swift

    associatedtype Input
  • The value the transformer will output.

    Declaration

    Swift

    associatedtype Output
  • Transform the provided value.

    Declaration

    Swift

    func transformValue(_ value: Input) throws -> Output

    Parameters

    value

    The value to transform.

    Return Value

    The transformed value.

  • Untransform the provided value.

    Declaration

    Swift

    func untransformValue(_ value: Output) throws -> Input

    Parameters

    value

    The the value to untransform.

    Return Value

    The untransformed value.

  • append(transformer:) Extension method

    Create a new transformer that aggregates self and the provided transfomer.

    Declaration

    Swift

    public func append<Transformer: Persist.Transformer>(
        transformer: Transformer
    ) -> AggregateTransformer<Input, Transformer.Output> where Transformer.Input == Output

    Parameters

    transformer

    The transformer to aggregate with this transformer.

    Return Value

    The aggregate transformer.