valguard/val

Values

pub fn date_is_valid(datetime: String) -> Result(Nil, String)

Validates that a date is valid by checking it can be parsed correctly

pub fn email_is_valid(email: String) -> Result(Nil, String)

Validates if entered email is a valid email address

pub fn float_max(
  value: Float,
  max maximum: Float,
) -> Result(Nil, String)

Validates an float is at most a maximum value. Returns an error if value is greater than the maximum

pub fn float_min(
  value: Float,
  min minimum: Float,
) -> Result(Nil, String)

Validates an float is at least a minimum value. Returns an error if value is less than the minimum

pub fn float_required(value: Float) -> Result(Nil, String)

Requires a float to be less than or greater than 0.0 to be considered required

pub fn int_max(
  value: Int,
  max maximum: Int,
) -> Result(Nil, String)

Validates an int is at most a maximum value. Returns an error if value is greater than the maximum

pub fn int_min(
  value: Int,
  min minimum: Int,
) -> Result(Nil, String)

Validates an int is at least a minimum value. Returns an error if value is less than the minimum

pub fn int_required(value: Int) -> Result(Nil, String)

Requires a int to be less than or greater than 0 to be considered required

pub fn string_max(
  value: String,
  max maximum: Int,
) -> Result(Nil, String)

Validates a string is at most a maximum length

pub fn string_min(
  value: String,
  min minimum: Int,
) -> Result(Nil, String)

Validates a string is a minimum length

pub fn string_required(value: String) -> Result(Nil, String)

Requires a string to not be empty to be considered required

Search Document