xBacon v0.1.0 XBacon.Changeset.CNPJ

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

Summary

Functions

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

Functions

validate_cnpj(changeset, field \\ :cnpj, opts \\ [])

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

Example

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

It will look up for a field named :cnpj 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_cnpj(:cadastro_juridico)