Lamina.Server.ConfigValue (lamina v0.4.2)

A wrapper around an individual configuration value.

It makes the code much simpler. That is all.

Summary

Functions

Perform a value cast using the ConfigValue's module.

Has the ConfigValue expired?

Perform a value validation using the ConfigValue's module.

Types

Link to this type

config_key()

@type config_key() :: atom()
@type lifetime() :: Lamina.Provider.lifetime()
@type provider() :: module()
Link to this type

provider_index()

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

Functions

Link to this function

cast(config_value)

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

Perform a value cast using the ConfigValue's module.

Link to this function

expired?(config_value)

@spec expired?(t()) :: boolean()

Has the ConfigValue expired?

Link to this function

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

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

Initialise a new ConfigValue.

Link to this function

validate(config_value)

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

Perform a value validation using the ConfigValue's module.