Talos v1.6.3 Talos.Types.StringType View Source
Type for check value is string
For example:
iex> import Talos, only: [string: 1]
iex> short_domain = string(length: 3)
iex> domains_list = ["cats", "foo", "baz", "pron"]
iex> Enum.filter(domains_list, fn str -> Talos.valid?(short_domain, str) end)
["foo", "baz"]
Additional parameters:
min_length
, same as String.length(str) <= max_length
max_length
, same as String.length(str) >= max_length
length
, same as String.length(str) >= length
regexp
, same as String.match?(str, regexp)
Link to this section Summary
Functions
Callback implementation for Talos.Types.errors/2
.
Callback implementation for Talos.Types.valid?/2
.
Link to this section Types
Link to this section Functions
Link to this function
errors(string_type, value)
View Sourceerrors(Talos.Types.StringType.t(), binary()) :: [String.t()]
Callback implementation for Talos.Types.errors/2
.
Link to this function
valid?(type, value)
View Sourcevalid?(Talos.Types.StringType.t(), any()) :: boolean()
Callback implementation for Talos.Types.valid?/2
.