Filtrex v0.4.3 Filtrex.Type.Config
This configuration struct is for passing options at the top-level (e.g. Filtrex.parse/2
) in a list. See defconfig/1
for a more specific example.
Struct keys:
type
: the corresponding condition module with this type (e.g. :text = Filtrex.Condition.Text)keys
: the allowed keys for this configurationoptions
: the configuration options to be passed to the condition
Summary
Functions
Returns whether the passed key is listed in any of the configurations
Returns the configuration for the specified key
Narrows the list of configurations to only the specified type
Returns the specific options of a configuration based on the key
Convert a list of mixed atoms and/or strings to a list of strings
Macros
Generate a config struct for Filtrex.Condition.Boolean
Generate a config struct for Filtrex.Condition.Date
Generate a config struct for Filtrex.Condition.DateTime
Allows easy creation of a configuration list
Generate a config struct for Filtrex.Condition.Number
Generate a config struct for Filtrex.Condition.Text
Types
t :: Filtrex.Type.Config
Functions
Macros
Generate a config struct for Filtrex.Condition.Boolean
Generate a config struct for Filtrex.Condition.Date
Generate a config struct for Filtrex.Condition.DateTime
Allows easy creation of a configuration list:
iex> import Filtrex.Type.Config
iex>
iex> defconfig do
iex> # Single key can be passed
iex> number :rating, allow_decimal: true
iex>
iex> # Multiple keys
iex> text [:title, :description]
iex>
iex> # String key can be passed
iex> date "posted", format: "{ISOz}"
iex> end
[
%Filtrex.Type.Config{keys: ["rating"], options: %{allow_decimal: true}, type: :number},
%Filtrex.Type.Config{keys: ["title", "description"], options: %{}, type: :text},
%Filtrex.Type.Config{keys: ["posted"], options: %{format: "{ISOz}"}, type: :date}
]
Generate a config struct for Filtrex.Condition.Number
Generate a config struct for Filtrex.Condition.Text