View Source Tyyppi.Value (tyyppi v0.12.3)
Value type to be used with Tyyppi
.
It wraps the standard Elixir type in a struct, also providing optional coercion,
validation, documentation, and Access
implementation.
built-in-constructors
Built-in constructors
any
atom
string
boolean
integer
non_neg_integer
pos_integer
timeout
pid
mfa
mod_arg
fun
one_of
formulae
list
— creates a[type()]
wrapped into a valuestruct
Link to this section Summary
Types
Type of the coercion function allowed
Type of the encoder function, that might be used for e. g. Json serialization
Type of the generator function, producing the stream of value()
Type of the validation function allowed
Functions
Creates a not defined any()
wrapped by Tyyppi.Value
Factory for any()
wrapped by Tyyppi.Value
Creates a not defined atom()
wrapped by Tyyppi.Value
Factory for atom()
wrapped by Tyyppi.Value
Creates a not defined boolean()
wrapped by Tyyppi.Value
Factory for boolean()
wrapped by Tyyppi.Value
Creates a not defined date()
wrapped by Tyyppi.Value
Factory for date()
wrapped by Tyyppi.Value
Creates a not defined date_time()
wrapped by Tyyppi.Value
Factory for date_time()
wrapped by Tyyppi.Value
Creates a not defined float()
wrapped by Tyyppi.Value
Factory for float()
wrapped by Tyyppi.Value
Creates a not defined formulae
wrapped by Tyyppi.Value
Factory for formulae
wrapped by Tyyppi.Value
Creates a not defined fun
wrapped by Tyyppi.Value
Creates a not defined integer()
wrapped by Tyyppi.Value
Factory for integer()
wrapped by Tyyppi.Value
Helper guard to match instances of struct Formulae
Creates a not defined list
wrapped by Tyyppi.Value
Factory for list
wrapped by Tyyppi.Value
Creates a not defined mfa
wrapped by Tyyppi.Value
Factory for mfa
wrapped by Tyyppi.Value
Factory for mfa
wrapped by Tyyppi.Value
Creates a not defined mod_arg
wrapped by Tyyppi.Value
Factory for mod_arg
wrapped by Tyyppi.Value
Factory for mod_arg
wrapped by Tyyppi.Value
Creates a not defined non_neg_integer()
wrapped by Tyyppi.Value
Factory for non_neg_integer()
wrapped by Tyyppi.Value
Creates a one_of
value wrapped by Tyyppi.Value
Creates a not defined pid()
wrapped by Tyyppi.Value
Factory for pid()
wrapped by Tyyppi.Value
Factory for pid()
wrapped by Tyyppi.Value
Creates a not defined pos_integer()
wrapped by Tyyppi.Value
Factory for pos_integer()
wrapped by Tyyppi.Value
Creates a not defined String.t()
wrapped by Tyyppi.Value
Factory for String.t()
wrapped by Tyyppi.Value
Creates a not defined struct
wrapped by Tyyppi.Value
Factory for struct
wrapped by Tyyppi.Value
Creates a not defined timeout()
wrapped by Tyyppi.Value
Factory for timeout()
wrapped by Tyyppi.Value
Link to this section Types
@type coercer() :: (Tyyppi.Valuable.value() -> Tyyppi.Valuable.either())
Type of the coercion function allowed
@type encoder() :: (Tyyppi.Valuable.value(), keyword() -> binary()) | nil
Type of the encoder function, that might be used for e. g. Json serialization
@type generator() :: (() -> Tyyppi.Valuable.generation()) | (any() -> Tyyppi.Valuable.generation())
Type of the generator function, producing the stream of value()
@type t(wrapped) :: %Tyyppi.Value{ value: Tyyppi.Valuable.value(), documentation: String.t(), type: Tyyppi.T.t(wrapped), coercion: coercer(), validation: validator(), encoding: encoder(), generation: {generator(), any()} | generator() | nil, __meta__: %{ defined?: boolean(), optional?: boolean(), errors: [any()], subsection: String.t() }, __context__: %{optional(atom()) => any()} }
@type validator() :: (Tyyppi.Valuable.value() -> Tyyppi.Valuable.either()) | (Tyyppi.Valuable.value(), %{required(atom()) => any()} -> Tyyppi.Valuable.either())
Type of the validation function allowed
Link to this section Functions
@spec any() :: t()
Creates a not defined any()
wrapped by Tyyppi.Value
@spec any(any() | [factory_option()]) :: t()
Factory for any()
wrapped by Tyyppi.Value
@spec atom() :: t()
Creates a not defined atom()
wrapped by Tyyppi.Value
@spec atom(options :: any() | [factory_option()]) :: t()
Factory for atom()
wrapped by Tyyppi.Value
@spec boolean() :: t()
Creates a not defined boolean()
wrapped by Tyyppi.Value
@spec boolean(options :: any() | [factory_option()]) :: t()
Factory for boolean()
wrapped by Tyyppi.Value
@spec date() :: t()
Creates a not defined date()
wrapped by Tyyppi.Value
@spec date(options :: any() | [factory_option()]) :: t()
Factory for date()
wrapped by Tyyppi.Value
@spec date_time() :: t()
Creates a not defined date_time()
wrapped by Tyyppi.Value
@spec date_time(options :: any() | [factory_option()]) :: t()
Factory for date_time()
wrapped by Tyyppi.Value
@spec float() :: t()
Creates a not defined float()
wrapped by Tyyppi.Value
@spec float(options :: any() | [factory_option()]) :: t()
Factory for float()
wrapped by Tyyppi.Value
@spec formulae() :: t()
Creates a not defined formulae
wrapped by Tyyppi.Value
@spec formulae( options :: Formulae.t() | binary() | [{:formulae, any()} | factory_option()] ) :: t()
@spec formulae( value :: any(), formulae :: Formulae.t() | binary() | {module(), atom(), list()} ) :: t()
Factory for formulae
wrapped by Tyyppi.Value
Creates a not defined fun
wrapped by Tyyppi.Value
@spec integer() :: t()
Creates a not defined integer()
wrapped by Tyyppi.Value
@spec integer(options :: any() | [factory_option()]) :: t()
Factory for integer()
wrapped by Tyyppi.Value
Helper guard to match instances of struct Formulae
@spec list() :: t()
Creates a not defined list
wrapped by Tyyppi.Value
@spec list( options :: Tyyppi.T.t(wrapped) | [{:type, Tyyppi.T.t(wrapped)} | factory_option()] ) :: t(wrapped) when wrapped: term()
Factory for list
wrapped by Tyyppi.Value
@spec list(value :: list(), type :: Tyyppi.T.t(wrapped)) :: t(wrapped) when wrapped: term()
@spec mfa() :: t()
Creates a not defined mfa
wrapped by Tyyppi.Value
@spec mfa( options :: boolean() | function() | {module(), atom(), non_neg_integer()} | [{:existing, boolean()} | factory_option()] ) :: t()
Factory for mfa
wrapped by Tyyppi.Value
@spec mfa(m :: module(), f :: atom(), a :: non_neg_integer()) :: t()
Factory for mfa
wrapped by Tyyppi.Value
@spec mod_arg() :: t()
Creates a not defined mod_arg
wrapped by Tyyppi.Value
@spec mod_arg( options :: boolean() | {module(), list()} | [{:existing, boolean()} | factory_option()] ) :: t()
Factory for mod_arg
wrapped by Tyyppi.Value
Factory for mod_arg
wrapped by Tyyppi.Value
@spec non_neg_integer() :: t()
Creates a not defined non_neg_integer()
wrapped by Tyyppi.Value
@spec non_neg_integer(options :: any() | [factory_option()]) :: t()
Factory for non_neg_integer()
wrapped by Tyyppi.Value
Creates a one_of
value wrapped by Tyyppi.Value
@spec pid() :: t()
Creates a not defined pid()
wrapped by Tyyppi.Value
@spec pid(options :: any() | [factory_option()]) :: t()
Factory for pid()
wrapped by Tyyppi.Value
@spec pid(p1 :: non_neg_integer(), p2 :: non_neg_integer(), p3 :: non_neg_integer()) :: t()
Factory for pid()
wrapped by Tyyppi.Value
@spec pos_integer() :: t()
Creates a not defined pos_integer()
wrapped by Tyyppi.Value
@spec pos_integer(options :: any() | [factory_option()]) :: t()
Factory for pos_integer()
wrapped by Tyyppi.Value
@spec string() :: t()
Creates a not defined String.t()
wrapped by Tyyppi.Value
@spec string(options :: any() | [factory_option()]) :: t()
Factory for String.t()
wrapped by Tyyppi.Value
@spec struct() :: t()
Creates a not defined struct
wrapped by Tyyppi.Value
@spec struct(options :: [factory_option()]) :: t()
@spec struct(value :: struct()) :: t()
Factory for struct
wrapped by Tyyppi.Value
@spec timeout() :: t()
Creates a not defined timeout()
wrapped by Tyyppi.Value
@spec timeout(options :: any() | [factory_option()]) :: t()
Factory for timeout()
wrapped by Tyyppi.Value
@spec validate(data :: t(), any()) :: Tyyppi.Valuable.either()