ApiCommons.Parameter.Check (ApiCommons v0.1.0) View Source

Similar to Ecto.Changeset. Collects and holds information on valid and invalid parameters passed to the endpoint. Collect information on validity of endpoint parameter check ups.

Struct Keys

  • valid? (boolean) Are the provided parameters are valid?
  • schema (Ecto.Schema|nil) A schema to check parameter against
  • parsed (Map) The parsed values
  • opts (List) Additional options passed down
  • errors - The errors accumulated while checking the parameters

Link to this section Summary

Functions

Save checks on parameters
Update check with single parameter checks.

## Parameter
    - check (Check)
    - param (Parameter)

## Returns
    - (Check)
Perform an update on the check struct.

## Parameters
    - field (atom) The field for which to perform an update
    - value (any) The value which resulted from performing checks
    - check (Check) The old check struct

## Returns
    - Updated check struct.
Update the parameter checks struct.

Link to this section Types

Specs

t() :: %ApiCommons.Parameter.Check{
  data: map(),
  errors: map(),
  opts: term(),
  parsed: map(),
  schema: term(),
  valid?: boolean()
}

Link to this section Functions

Link to this function

%ApiCommons.Parameter.Check{}

View Source (struct)
Save checks on parameters
Update check with single parameter checks.

## Parameter
    - check (Check)
    - param (Parameter)

## Returns
    - (Check)
Link to this function

update(field, value, check)

View Source
Perform an update on the check struct.

## Parameters
    - field (atom) The field for which to perform an update
    - value (any) The value which resulted from performing checks
    - check (Check) The old check struct

## Returns
    - Updated check struct.
Link to this function

update(field, value, check, opts \\ [])

View Source
Update the parameter checks struct.