resx v0.1.0 Resx.Transformer behaviour
A transformer is a referenceable interface for performing reproducible modifications on resources.
A module that implements the transformer behaviour becomes usable by the Resx.Producers.Transform
producer.
Link to this section Summary
Callbacks
Implement the behaviour to transform a resource
Link to this section Functions
apply!(Resx.Resource.t(), module(), keyword()) :: Resx.Resource.t() | no_return()
Apply a transformation to a resource.
Raises a Resx.Transformer.TransformError
if the transformation cannot be applied.
For more details see apply/2
.
apply(Resx.Resource.t(), module(), keyword()) :: {:ok, Resx.Resource.t()} | Resx.error()
Apply a transformation to a resource.
A transformer
must be a module that implements the Resx.Transformer
behaviour.
Link to this section Callbacks
transform(resource :: Resx.Resource.t(), options :: keyword()) :: {:ok, resource :: Resx.Resource.t()} | Resx.error()
Implement the behaviour to transform a resource.
The options
keyword allows for your implementation to expose some configurable settings.
If the transformation was successful return { :ok, resource }
, where resource
is the newly transformed resource. Otherwise return an appropriate error.