A Golang library to provide Brazilian Documents safer, easier and fun!
go-documents requires Go 1.11 or later.
go get github.com/brazanation/go-documents
If you want to get an specific version, please use the example below:
go get gopkg.in/brazanation/go-documents.v0
- Install Go
// Clean up
$ make clean
// Run tests and generates html coverage file
make cover
// Download project dependencies
make depend
// Format all go files
make fmt
// Run linters
make lint
// Run tests
make test
Read the full documentation at https://godoc.org/github.com/brazanation/go-documents.
Registration of individuals or Tax Identification
doc, err := brdocs.NewCpf("06843273173")
if err != nil {
panic(err)
}
println(doc.String()) // prints 06843273173
println(doc.Format()) // prints 068.432.731-73
Company Identification or National Register of Legal Entities
doc, err := brdocs.NewCnpj("99999090910270")
if err != nil {
panic(err)
}
println(doc.String()) // prints 99999090910270
println(doc.Format()) // prints 99.999.090/9102-70
National Driving License
doc, err := brdocs.NewCnh("83592802666")
if err != nil {
panic(err)
}
println(doc.String()) // prints 83592802666
println(doc.Format()) // prints 83592802666
National Health Card
doc, err := brdocs.NewCns("242912018460005")
if err != nil {
panic(err)
}
println(doc.String()) // prints 242912018460005
println(doc.Format()) // prints 242 9120 1846 0005
Social Integration Program and Training Program of the Heritage of Public Servant
doc, err := brdocs.NewPisPasep("51823129491")
if err != nil {
panic(err)
}
println(doc.String()) // prints 51823129491
println(doc.Format()) // prints 518.23129.49-1
Voter Registration
doc, err := brdocs.NewVoter("247003181023")
if err != nil {
panic(err)
}
println(doc.String()) // prints 247003181023
println(doc.Format()) // prints 247003181023
National Registry of Motor Vehicles
doc, err := brdocs.NewRenavam("61855253306")
if err != nil {
panic(err)
}
println(doc.String()) // prints 61855253306
println(doc.Format()) // prints 6185.525330-6
This project is released under the MIT licence. See LICENSE for more details.