Lamina.Server.ConfigValue (lamina v0.2.2)

A wrapper around an individual configuration value.

It makes the code much simpler. That is all.

Link to this section Summary

Functions

Perform a value cast using the ConfigValue's module.

Has the ConfigValue expired?

Perform a value validation using the ConfigValue's module.

Link to this section Types

Link to this type

config_key()

Specs

config_key() :: atom()

Specs

lifetime() :: Lamina.Provider.lifetime()

Specs

provider() :: module()
Link to this type

provider_index()

Specs

provider_index() :: pos_integer()

Specs

t() :: %Lamina.Server.ConfigValue{
  config_key: atom(),
  expires_at: nil | pos_integer(),
  lifetime: lifetime(),
  module: module(),
  provider: module(),
  provider_index: pos_integer(),
  value: any()
}

Link to this section Functions

Link to this function

cast(config_value)

Specs

cast(t()) :: {:ok, t()} | {:error, any()}

Perform a value cast using the ConfigValue's module.

Link to this function

expired?(config_value)

Specs

expired?(t()) :: boolean()

Has the ConfigValue expired?

Link to this function

init(config_key, lifetime, module, provider, provider_index, value)

Specs

init(config_key(), lifetime(), module(), provider(), provider_index(), any()) ::
  {:ok, t()} | {:error, ArgumentError.t()}

Initialise a new ConfigValue.

Link to this function

validate(config_value)

Specs

validate(t()) :: {:ok, t()} | {:error, any()}

Perform a value validation using the ConfigValue's module.