View Source Vx.Union (Vx v0.1.0)
The Union type combines multiple types into a single type, validating whether any of them is valid.
Summary
Types
@opaque t(of)
Functions
Builds a new Union type.
Examples
iex> Vx.Union.t([Vx.Integer.t(), Vx.String.t()]) |> Vx.validate!(123)
:ok
iex> Vx.Union.t([Vx.Integer.t(), Vx.String.t()]) |> Vx.validate!(:foo)
** (Vx.Error) must be any of (integer | string)