brcpfcnpj v0.2.1 Brcpfcnpj.Changeset

Define funções para serem utilizadas em conjunto com a API de changeset do Ecto.

Link to this section Summary

Functions

Valida se essa mudança é um cnpj válido. Aceita um ou mais fields

Valida se essa mudança é um cpf válido. Aceita um ou mais fields

Link to this section Types

Link to this type

changeset()

changeset() :: Ecto.Changeset.t()
Link to this type

error()

error() :: {atom(), error_message()}
Link to this type

error_message()

error_message() :: String.t() | {String.t(), Keyword.t()}

Link to this section Functions

Link to this function

validate_cnpj(changeset, field)

Valida se essa mudança é um cnpj válido. Aceita um ou mais fields

Options

  • :message - A mensagem em caso de erro, o default é "Invalid Cnpj"

Examples

validate_cnpj(changeset, :cnpj)

validate_cnpj(changeset, [:cnpj, :other_cnpj])
Link to this function

validate_cnpj(changeset, field, opts)

validate_cnpj(changeset(), atom() | list(), Keyword.t()) :: changeset()
Link to this function

validate_cpf(changeset, field)

Valida se essa mudança é um cpf válido. Aceita um ou mais fields

Options

  • :message - A mensagem em caso de erro, o default é "Invalid Cpf"

Examples

validate_cpf(changeset, :cpf)

validate_cpf(changeset, [:cpf, :cnpj])
Link to this function

validate_cpf(changeset, field, opts)

validate_cpf(changeset(), atom() | list(), Keyword.t()) :: changeset()