dataval/validator

Types

pub type Validator(a, custom) =
  fn(a) -> Result(a, List(field.FieldError(custom)))

Values

pub fn float_max(
  max: Float,
) -> fn(Float) -> Result(Float, List(field.FieldError(custom)))
pub fn float_min(
  min: Float,
) -> fn(Float) -> Result(Float, List(field.FieldError(custom)))
pub fn int_max(
  max: Int,
) -> fn(Int) -> Result(Int, List(field.FieldError(custom)))
pub fn int_min(
  min: Int,
) -> fn(Int) -> Result(Int, List(field.FieldError(custom)))
pub fn not_empty(
  value: String,
) -> Result(String, List(field.FieldError(custom)))

Validate that the value is not an empty string

Same as required()

pub fn regexp_check(
  re: regexp.Regexp,
) -> fn(String) -> Result(String, List(field.FieldError(custom)))
pub fn required(
  value: String,
) -> Result(String, List(field.FieldError(custom)))

Validate that the value is not an empty string

Same as not_empty()

pub fn str_max(
  max: Int,
) -> fn(String) -> Result(String, List(field.FieldError(custom)))
pub fn str_min(
  min: Int,
) -> fn(String) -> Result(String, List(field.FieldError(custom)))
Search Document