View Source Vx.Intersect (Vx v0.4.0)

The Intersect type combines multiple types into a single type, validating whether all of them are valid.

Summary

Functions

Builds a new Intersect type.

Types

Functions

@spec t(of) :: t(of) when of: [Vx.schema(), ...]

Builds a new Intersect type.

Examples

iex> Vx.Intersect.t([Vx.Integer.t(), Vx.Number.t()]) |> Vx.validate!(123)
:ok

iex> Vx.Intersect.t([Vx.Integer.t(), Vx.Number.t()]) |> Vx.validate!(12.3)
** (Vx.Error) must be all of (integer & number)