okay

Types

pub type Error {
  IsGreater(value: Int, expected: Int)
  IsGreaterOrEqual(value: Int, expected: Int)
  IsLonger(value: String, actual: Int, expected: Int)
  IsLesser(value: Int, expected: Int)
  IsLesserOrEqual(value: Int, expected: Int)
  IsEqual(value: String, expected: String)
  IsIncludedIn(value: String, expected: String)
  IsBool(value: Bool, expected: Bool)
}

Constructors

  • IsGreater(value: Int, expected: Int)
  • IsGreaterOrEqual(value: Int, expected: Int)
  • IsLonger(value: String, actual: Int, expected: Int)
  • IsLesser(value: Int, expected: Int)
  • IsLesserOrEqual(value: Int, expected: Int)
  • IsEqual(value: String, expected: String)
  • IsIncludedIn(value: String, expected: String)
  • IsBool(value: Bool, expected: Bool)
pub type Okay {
  Okay(errors: List(ValidationError))
}

Constructors

  • Okay(errors: List(ValidationError))
pub type ValidationError {
  ValidationError(field: String, error: Error)
}

Constructors

  • ValidationError(field: String, error: Error)

Functions

pub fn field(
  okay: Okay,
  field: String,
  result: Result(Nil, Error),
) -> Okay
pub fn is_equal(value: a, compare: a) -> Result(Nil, Error)
pub fn is_false(value: Bool) -> Result(Nil, Error)
pub fn is_gt(value: Int, compare: Int) -> Result(Nil, Error)
pub fn is_gte(value: Int, compare: Int) -> Result(Nil, Error)
pub fn is_included_in(
  value: a,
  whitelist: List(a),
) -> Result(Nil, Error)
pub fn is_longer(
  value: String,
  length: Int,
) -> Result(Nil, Error)
pub fn is_lt(value: Int, compare: Int) -> Result(Nil, Error)
pub fn is_lte(value: Int, compare: Int) -> Result(Nil, Error)
pub fn is_true(value: Bool) -> Result(Nil, Error)
pub fn new() -> Okay
pub fn run(okay: Okay) -> Result(Nil, Okay)
Search Document