View Source Skema.Result (Skema v1.0.0)

Result Struct for Skema operations

Summary

Functions

Get error from result for given field.

Create a new Result struct with given schema map and params.

Put valid data to result.

Put error to result.

Functions

Link to this function

get_error(result, field)

View Source
@spec get_error(
  %Skema.Result{
    errors: term(),
    params: term(),
    schema: term(),
    valid?: term(),
    valid_data: term()
  },
  field :: atom()
) :: String.t() | nil

Get error from result for given field.

@spec new(%{}) :: %Skema.Result{
  errors: term(),
  params: term(),
  schema: term(),
  valid?: term(),
  valid_data: term()
}

Create a new Result struct with given schema map and params.

Link to this function

put_data(result, field, value)

View Source
@spec put_data(
  %Skema.Result{
    errors: term(),
    params: term(),
    schema: term(),
    valid?: term(),
    valid_data: term()
  },
  field :: atom(),
  value :: any()
) :: %Skema.Result{
  errors: term(),
  params: term(),
  schema: term(),
  valid?: term(),
  valid_data: term()
}

Put valid data to result.

Link to this function

put_error(result, field, error)

View Source
@spec put_error(
  %Skema.Result{
    errors: term(),
    params: term(),
    schema: term(),
    valid?: term(),
    valid_data: term()
  },
  field :: atom(),
  error :: String.t()
) :: %Skema.Result{
  errors: term(),
  params: term(),
  schema: term(),
  valid?: term(),
  valid_data: term()
}

Put error to result.