Formular.Client.Config (formular_client v0.4.0-alpha.1)
Configuration for a Formular client.
The following keys are currently supported:
client_name
- the identity of the client, can be any string. Default
nil
- the identity of the client, can be any string. Default
url
- the url of the remote server, default
nil
- the url of the remote server, default
read_timeout
- a timeout setting for waiting for all the formulas
formulas
- formula definition, check "Formula Configuration" section for more information.
compiler
- MFA config for compiling the string into Elixir code
adapter
- an adapter for getting the data from the remote server
Formula Configuration
A fomular is configured as a two-element tuple:
{"my-formula", compile_as: MyFm, context: My.ContextModule}
Here MyFm
is the name of module for the code to be compiled into;
"my-formula"
is the name of the formula on the server;
My.ContextModule
is the helper module that can be used in the
code.
A single formula name string is also accepted:
[ ... formulas: ["my-formula"] ]
In this case, `compile_as` and `context` are optional and treated as
`nil`s.
Link to this section Summary
Link to this section Types
Link to this type
compile_function()
Specs
Link to this type
compile_option()
Specs
Link to this type
compile_options()
Specs
compile_options() :: [compile_option()]
Link to this type
formula_def()
Specs
formula_def() :: {formula_name(), compile_options()}
Link to this type
formula_full_def()
Specs
Link to this type
formula_name()
Specs
formula_name() :: String.t()
Specs
t() :: %Formular.Client.Config{ adapter: {module(), keyword()}, client_name: String.t(), compiler: {module(), atom(), args :: list()} | compile_function(), formulas: [formula_def()], read_timeout: :infinity | non_neg_integer(), url: String.t() }
Link to this section Functions
Link to this function
formula_config(config, name)
Specs
formula_config(t(), formula_name()) :: formula_def() | nil
Get the config for a given formula name.
Link to this function
new(opts)
Specs
Build a new config constructure.