ConstructParams.CastDecorator (ConstructParams v0.3.0) View Source

The macro allows casting the incoming controller parameters.

This macro uses the construct library for params validation.

In case of a successful casting, the controller action params are replaced with the casted data. Otherwise the FallbackController is called with {:error, errors} parameters.

Examples

defmodule MyApp.MyController do
  use ConstructParams.CastDecorator

  @decorate cast(MyApp.ConstructCastModule)
  def create(conn, params)
  end
end

Link to this section Summary

Link to this section Functions

Link to this macro

cast(var1, var2)

View Source (macro)
Link to this function

cast(cast_module, body, context)

View Source
Link to this function

cast(cast_module, options, body, map)

View Source