codicefiscale

package module
v0.0.0-...-0b37fbd Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

panta/codicefiscale

Small library to check and decode Italian "Codice Fiscale" from Go.

Installation

First, use go get to install the latest version of the library:

go get -u github.com:panta/codicefiscale

Then include the library in your code:

import "panta/codicefiscale"

Usage

package main

import (
	"fmt"
	"time"

	"github.com/panta/codicefiscale"
)

func main() {
	cf, err := codicefiscale.Decode("RSSMRA77L18H501W")
	if err != nil {
		panic(err)
	}
	
	fmt.Printf("Birth date: %s place: %s (%s)",
		cf.BirthDate.Format(time.RFC3339),
		cf.BirthPlaceName, cf.BirthPlace.Provincia.Nome)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodiceFiscale

type CodiceFiscale struct {
	Code              string
	Surname           string
	Name              string
	Sex               Sex
	BirthDate         time.Time
	BirthDateYear     int
	BirthDateMonth    int
	BirthDateDay      int
	BirthPlaceName    string
	BirthPlaceComune  comuni.Comune
	BirthPlaceNazione comuni.Nazione
	Raw               CodiceFiscaleRaw
}

func Decode

func Decode(codice string) (*CodiceFiscale, error)

Decode decodes the "codice fiscale".

type CodiceFiscaleRaw

type CodiceFiscaleRaw struct {
	Code           string
	Surname        string
	Name           string
	BirthDate      string
	BirthDateYear  string
	BirthDateMonth string
	BirthDateDay   string
	BirthPlace     string
	CIN            string
}

type Sex

type Sex int
const (
	UnknownSex Sex = iota
	Male
	Female
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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