Categorygithub.com/paemuri/brdoc/v2
modulepackage
2.3.3
Repository: https://github.com/paemuri/brdoc.git
Documentation: pkg.go.dev

# README

BR Doc

License go.dev Travis CI Codecov.io Go Report Card

CPF, CNPJ, CEP, CNH, PIS/PASEP, RENAVAM, CNS and license plate validator for Go!

Everything in this file, but the License section, is in portuguese.

Descrição

BR Doc é um pacote para validação, tanto do formato quanto dos dígitos, de documentos brasileiros, como CPF, CNPJ, CEP, CNH, PIS/PASEP, RENAVAM, placa veicular e RG no padrão SP e RJ (futuramente demais padrões).

Aceito PRs de todas as formas. Está permitido escrever em português, também. :)

Uso

Principais funções:

  • func IsCPF(doc string) bool
  • func IsCNPJ(doc string) bool
  • func IsCEP(doc string, ufs ...FederativeUnit) bool
  • func IsCNH(doc string) bool
  • func IsPIS(doc string) bool
  • func IsRENAVAM(doc string) bool
  • func IsPlate(doc string) bool
  • func IsNationalPlate(doc string) bool
  • func IsMercosulPlate(doc string) bool
  • func IsCNS(doc string) bool
  • func IsRG(doc string) bool

Coisas a fazer

  • validação de CPF
  • validação de CNPJ
  • validação de CEP
  • validação de CNH (obrigado @eminetto!)
  • validação de RENAVAM (obrigado @leogregianin!)
  • validação de placa veicular
  • validação de CNS (obrigado @renatosuero!)
  • validação de RG
    • SP (obrigado @robas!)
    • RJ (obrigado @robas!)
    • demais estados

License

This project code is in the public domain. See the LICENSE file.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be in the public domain, without any additional terms or conditions.

# Functions

IsCEP verifies if `doc` is a valid CEP.
IsCNH verifies if the given string is a valid CNH document.
IsCNPJ verifies if the given string is a valid CNPJ document.
IsCNS verifies if the given string is a valid CNS document.
IsCPF verifies if the given string is a valid CPF document.
IsMercosulPlate verifies if the given string is a valid license plate in the new Mercosul format.
IsNationalPlate verifies if the given string is a valid license plate in the old national format.
IsPIS verifies if the given string is a valid PIS number.
IsPlate verifies if the given string is a valid license plate.IsPlate It can be either in the old national format or the new Mercosul one.
IsRENAVAM verifies if the given string is a valid RENAVAM document.
IsRG verifies if `doc` is a valid RG.

# Constants

Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.
Federative unit for CEP validation.

# Variables

Regexp pattern for CEP.
Regexp pattern for CPF and CNPJ.
Regexp pattern for CNS.
Regexp pattern for CPF and CNPJ.
Regexp pattern for license plates patterns.
Regexp pattern for license plates patterns.
Regexp pattern for PIS.

# Type aliases

FederativeUnit represents a state or a district in Brazil.