Tyyppi.Value (tyyppi v0.8.1) View Source
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
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_time()
wrapped by Tyyppi.Value
Factory for timeout()
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
Specs
coercer() :: (Tyyppi.Valuable.value() -> Tyyppi.Valuable.either())
Type of the coercion function allowed
Specs
encoder() :: (Tyyppi.Valuable.value(), keyword() -> binary()) | nil
Type of the encoder function, that might be used for e. g. Json serialization
Specs
Specs
generator() :: (() -> Tyyppi.Valuable.generation()) | (any() -> Tyyppi.Valuable.generation())
Type of the generator function, producing the stream of value()
Specs
Specs
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()} }
Specs
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
Specs
any() :: t()
Creates a not defined any()
wrapped by Tyyppi.Value
Specs
any(any() | [factory_option()]) :: t()
Factory for any()
wrapped by Tyyppi.Value
Specs
atom() :: t()
Creates a not defined atom()
wrapped by Tyyppi.Value
Specs
atom(options :: any() | [factory_option()]) :: t()
Factory for atom()
wrapped by Tyyppi.Value
Specs
boolean() :: t()
Creates a not defined boolean()
wrapped by Tyyppi.Value
Specs
boolean(options :: any() | [factory_option()]) :: t()
Factory for boolean()
wrapped by Tyyppi.Value
Specs
date_time() :: t()
Creates a not defined date_time()
wrapped by Tyyppi.Value
Specs
date_time(options :: any() | [factory_option()]) :: t()
Factory for timeout()
wrapped by Tyyppi.Value
Specs
formulae() :: t()
Creates a not defined formulae
wrapped by Tyyppi.Value
Specs
formulae( options :: Formulae.t() | binary() | [{:formulae, any()} | factory_option()] ) :: t()
Specs
Factory for formulae
wrapped by Tyyppi.Value
Specs
Creates a not defined fun
wrapped by Tyyppi.Value
Specs
integer() :: t()
Creates a not defined integer()
wrapped by Tyyppi.Value
Specs
integer(options :: any() | [factory_option()]) :: t()
Factory for integer()
wrapped by Tyyppi.Value
Helper guard to match instances of struct Formulae
Specs
list() :: t()
Creates a not defined list
wrapped by Tyyppi.Value
Specs
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
Specs
list(value :: list(), type :: Tyyppi.T.t(wrapped)) :: t(wrapped) when wrapped: term()
Specs
mfa() :: t()
Creates a not defined mfa
wrapped by Tyyppi.Value
Specs
mfa( options :: boolean() | function() | {module(), atom(), non_neg_integer()} | [{:existing, boolean()} | factory_option()] ) :: t()
Factory for mfa
wrapped by Tyyppi.Value
Specs
mfa(m :: module(), f :: atom(), a :: non_neg_integer()) :: t()
Factory for mfa
wrapped by Tyyppi.Value
Specs
mod_arg() :: t()
Creates a not defined mod_arg
wrapped by Tyyppi.Value
Specs
mod_arg( options :: boolean() | {module(), list()} | [{:existing, boolean()} | factory_option()] ) :: t()
Factory for mod_arg
wrapped by Tyyppi.Value
Specs
Factory for mod_arg
wrapped by Tyyppi.Value
Specs
non_neg_integer() :: t()
Creates a not defined non_neg_integer()
wrapped by Tyyppi.Value
Specs
non_neg_integer(options :: any() | [factory_option()]) :: t()
Factory for non_neg_integer()
wrapped by Tyyppi.Value
Specs
Creates a one_of
value wrapped by Tyyppi.Value
Specs
Specs
Specs
pid() :: t()
Creates a not defined pid()
wrapped by Tyyppi.Value
Specs
pid(options :: any() | [factory_option()]) :: t()
Factory for pid()
wrapped by Tyyppi.Value
Specs
pid(p1 :: non_neg_integer(), p2 :: non_neg_integer(), p3 :: non_neg_integer()) :: t()
Factory for pid()
wrapped by Tyyppi.Value
Specs
pos_integer() :: t()
Creates a not defined pos_integer()
wrapped by Tyyppi.Value
Specs
pos_integer(options :: any() | [factory_option()]) :: t()
Factory for pos_integer()
wrapped by Tyyppi.Value
Specs
string() :: t()
Creates a not defined String.t()
wrapped by Tyyppi.Value
Specs
string(options :: any() | [factory_option()]) :: t()
Factory for String.t()
wrapped by Tyyppi.Value
Specs
struct() :: t()
Creates a not defined struct
wrapped by Tyyppi.Value
Specs
struct(options :: [factory_option()]) :: t()
struct(value :: struct()) :: t()
Factory for struct
wrapped by Tyyppi.Value
Specs
timeout() :: t()
Creates a not defined timeout()
wrapped by Tyyppi.Value
Specs
timeout(options :: any() | [factory_option()]) :: t()
Factory for timeout()
wrapped by Tyyppi.Value
Specs
validate(data :: t(), any()) :: Tyyppi.Valuable.either()