Formular.Client.Config (formular_client v0.3.0)

Configuration for a Formular client.

The following keys are currently supported:

  • client_name
    • the identity of the client, can be any string. Default nil
  • url
    • the url of the remote server, default nil
  • 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 three-element tuple:

{MyFm, "my-formula", 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.

Link to this section Summary

Functions

Get the config for a given formula name.

Build a new config constructure.

Link to this section Types

Link to this type

compile_function()

Specs

compile_function() ::
  ({name :: String.t(), code :: binary(), module(), nil | module()} ->
     :ok | {:error, term()})
Link to this type

formula_def()

Specs

formula_def() :: {module(), formula_name(), context :: module()}
Link to this type

formula_full_def()

Specs

formula_full_def() :: formula_def() | {module(), name :: String.t()}
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.

Specs

new(Enum.t()) :: t()

Build a new config constructure.