brdocs

package module
v0.0.0-...-fb6afb1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2019 License: MIT Imports: 4 Imported by: 0

README

Brazanation Documents - Golang

Build Status Codecov branch GoDoc Go Report Card License

A Golang library to provide Brazilian Documents safer, easier and fun!

Installation

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

Development

Requirements
  • Install Go
Makefile
// 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

Documentation

Read the full documentation at https://godoc.org/github.com/brazanation/go-documents.

CPF (cadastro de pessoas físicas)

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
CNPJ (cadastro nacional da pessoa jurídica)

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
CNH (carteira nacional de habilitação)

National Driving License

doc, err := brdocs.NewCnh("83592802666")
if err != nil {
    panic(err)
}
println(doc.String()) // prints 83592802666
println(doc.Format()) // prints 83592802666
Cartão Nacional de Saúde (SUS)

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
PIS/PASEP (programa de integração social e programa de formação do patrimônio do servidor público)

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
Título de Eleitor

Voter Registration

doc, err := brdocs.NewVoter("247003181023")
if err != nil {
    panic(err)
}
println(doc.String()) // prints 247003181023
println(doc.Format()) // prints 247003181023
Renavam (Registro Nacional de Veículos Automotores)

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

License

This project is released under the MIT licence. See LICENSE for more details.

Documentation

Index

Constants

View Source
const CnhType internal.DocumentType = "Cnh"
View Source
const CnpjType internal.DocumentType = "Cnpj"
View Source
const CnsType internal.DocumentType = "Cns"
View Source
const CpfType internal.DocumentType = "Cpf"
View Source
const PisPasepType internal.DocumentType = "PisPasep"
View Source
const RenavamType internal.DocumentType = "Renavam"
View Source
const VoterType internal.DocumentType = "Voter"

Variables

This section is empty.

Functions

func NewCnh

func NewCnh(number string) (internal.Document, error)

NewCnh is the constructor of cnh

func NewCnpj

func NewCnpj(number string) (internal.Document, error)

NewCnpj is the constructor of cnpj

func NewCns

func NewCns(number string) (internal.Document, error)

NewCns is the constructor of cns

func NewCpf

func NewCpf(number string) (internal.Document, error)

NewCpf is the constructor of cpf

func NewPisPasep

func NewPisPasep(number string) (internal.Document, error)

NewPisPasep is the constructor of pisPasep

func NewRenavam

func NewRenavam(number string) (internal.Document, error)

NewRenavam is the constructor of renavam

func NewVoter

func NewVoter(number string) (internal.Document, error)

NewVoter is the constructor of voter

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL