xBacon v0.1.0 XBacon.Changeset.CEP

Defines a set of validations for CEP that can be applied on a changeset using the XBacon.Matchers.CEP matchers

Summary

Functions

Validates the given changeset looking for the cep field, it allows customization of lookup field and error messages

Functions

validate_cep(changeset, field \\ :cep, opts \\ [])

Validates the given changeset looking for the cep field, it allows customization of lookup field and error messages.

Example

struct
|> cast(params, @fields)
|> validate_cep

It will look up for a field named :cep to acquire the value, if you do not use this name on field you can customize as second arity.

Example

 struct
 |> cast(params, @fields)
 |> validate_cep(:street_cep)