Trogon.TypeProvider (Trogon.TypeProvider v0.2.1)
View SourceProvides a type mapping system for converting between string type names and Elixir struct modules.
Summary
Functions
Imports all the types from another module defined by Trogon.TypeProvider
.
Registers a mapping from a type string to an Elixir Module that defines a struct.
Functions
Imports all the types from another module defined by Trogon.TypeProvider
.
Example
defmodule UserTypeProvider do
use Trogon.TypeProvider
# ...
end
defmodule MyAppTypeProvider do
use Trogon.TypeProvider
import_type_provider UserTypeProvider
end
Registers a mapping from a type string to an Elixir Module that defines a struct.
Example
defmodule MyTypeProvider do
use Trogon.TypeProvider,
prefix: "accounts." # optional, adds the prefix to the type
register_type "account_created", AccountCreated
end