Svelixir.Config.Enums (svelixir v0.11.0)

Copy Markdown

The closed domains the config sections draw their atom values from.

These live in one module rather than in each owning section because defenum/2 pattern-matches its second argument as a literal list at expansion time — handed @types it sees a Module.__get_attribute__ AST and raises invalid fields for enum. A module also cannot use a macro it defines itself. So a section cannot both declare its own enum and read the keys back for validation; the declaration has to sit somewhere it can be required from.

Everything defenum/2 generates is a macro, which is what makes that work: Enums.compose_keys() expands to the literal list inside a validates/2 option list at compile time, so the domain is written once and the validator and the type cannot drift apart.

Order is load-bearing for compose. defenum/2 numbers keys by position, so [:none, :podman, :docker] makes rank a comparison — Svelixir.Config.Container.at_least/2 relies on it.

Summary

Types

assets_type()

@type assets_type() :: :none | :api | :ui | :both | 0 | 1 | 2 | 3

assets_type_keys()

@type assets_type_keys() :: :none | :api | :ui | :both

assets_type_values()

@type assets_type_values() :: 0 | 1 | 2 | 3

cache_backend()

@type cache_backend() :: :local | :valkey | 0 | 1

cache_backend_keys()

@type cache_backend_keys() :: :local | :valkey

cache_backend_values()

@type cache_backend_values() :: 0 | 1

cache_mode()

@type cache_mode() :: :standalone | :cluster | :client_side_cluster | 0 | 1 | 2

cache_mode_keys()

@type cache_mode_keys() :: :standalone | :cluster | :client_side_cluster

cache_mode_values()

@type cache_mode_values() :: 0 | 1 | 2

compose()

@type compose() :: :none | :podman | :docker | 0 | 1 | 2

compose_keys()

@type compose_keys() :: :none | :podman | :docker

compose_values()

@type compose_values() :: 0 | 1 | 2

project_type()

@type project_type() :: :otp | :web | 0 | 1

project_type_keys()

@type project_type_keys() :: :otp | :web

project_type_values()

@type project_type_values() :: 0 | 1

Functions

assets_type(value)

(macro)

assets_type(value, type)

(macro)

assets_type_enumerators()

(macro)

assets_type_keys()

(macro)

assets_type_values()

(macro)

cache_backend(value)

(macro)

cache_backend(value, type)

(macro)

cache_backend_enumerators()

(macro)

cache_backend_keys()

(macro)

cache_backend_values()

(macro)

cache_mode(value)

(macro)

cache_mode(value, type)

(macro)

cache_mode_enumerators()

(macro)

cache_mode_keys()

(macro)

cache_mode_values()

(macro)

compose(value)

(macro)

compose(value, type)

(macro)

compose_enumerators()

(macro)

compose_keys()

(macro)

compose_values()

(macro)

is_assets_type(value)

(macro)

is_assets_type_key(value)

(macro)

is_assets_type_value(value)

(macro)

is_cache_backend(value)

(macro)

is_cache_backend_key(value)

(macro)

is_cache_backend_value(value)

(macro)

is_cache_mode(value)

(macro)

is_cache_mode_key(value)

(macro)

is_cache_mode_value(value)

(macro)

is_compose(value)

(macro)

is_compose_key(value)

(macro)

is_compose_value(value)

(macro)

is_project_type(value)

(macro)

is_project_type_key(value)

(macro)

is_project_type_value(value)

(macro)

project_type(value)

(macro)

project_type(value, type)

(macro)

project_type_enumerators()

(macro)

project_type_keys()

(macro)

project_type_values()

(macro)