View Source EnvGuard.Types (env_guard v1.0.0)

Shared type definitions for the supported cast targets and constraints.

These are the single source of truth referenced by EnvGuard, EnvGuard.Cast, and EnvGuard.Constraints, and must enumerate exactly the clauses those modules implement.

Summary

Types

A constraint that can be checked against a cast value.

A type an environment variable value can be cast to.

Types

@type constraint() ::
  {:length, integer()}
  | {:min_length, integer()}
  | {:max_length, integer()}
  | {:min, integer()}
  | {:max, integer()}
  | {:allow_empty?, boolean()}

A constraint that can be checked against a cast value.

@type type() ::
  :boolean
  | :string
  | :atom
  | :charlist
  | :integer
  | :float
  | {:list, type()}
  | {:enum, [String.t()]}

A type an environment variable value can be cast to.