BrazilianDocuments.Changeset (Brazilian Documents v0.3.0) View Source

Ecto changeset integration.

Link to this section Summary

Functions

Validates a change is a valid CNPJ.

Validates a change is a valid CPF.

Link to this section Functions

Link to this function

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

View Source

Specs

validate_cnpj(
  changeset :: Ecto.Changeset.t(),
  field :: atom(),
  opts :: Keyword.t()
) :: Ecto.Changeset.t()

Validates a change is a valid CNPJ.

Options

  • :message - the message on failure, defaults to "has invalid cnpj"

Examples

validate_cnpj(changeset, :cnpj)
Link to this function

validate_cpf(changeset, field, opts \\ [])

View Source

Specs

validate_cpf(
  changeset :: Ecto.Changeset.t(),
  field :: atom(),
  opts :: Keyword.t()
) :: Ecto.Changeset.t()

Validates a change is a valid CPF.

Options

  • :message - the message on failure, defaults to "has invalid cpf"

Examples

validate_cpf(changeset, :cpf)