Documentation ¶
Index ¶
- func Valid(pin string, options ...*Options) bool
- type Options
- type Personnummer
- func (p *Personnummer) Format(longFormat ...bool) (string, error)
- func (p *Personnummer) GetAge() int
- func (p *Personnummer) GetDate() time.Time
- func (p *Personnummer) IsCoordinationNumber() bool
- func (p *Personnummer) IsFemale() bool
- func (p *Personnummer) IsInterimNumber() bool
- func (p *Personnummer) IsMale() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Personnummer ¶
type Personnummer struct { Century string FullYear string Year string Month string Day string Sep string Num string Check string // contains filtered or unexported fields }
Personnummer represents the personnummer struct.
func New ¶
func New(pin string, options ...*Options) (*Personnummer, error)
New parse a Swedish personal identity numbers and returns a new struct or a error.
func Parse ¶
func Parse(pin string, options ...*Options) (*Personnummer, error)
Parse Swedish personal identity numbers and return a new struct.
func (*Personnummer) Format ¶
func (p *Personnummer) Format(longFormat ...bool) (string, error)
Format a Swedish personal identity number as one of the official formats, a long format or a short format.
func (*Personnummer) GetAge ¶
func (p *Personnummer) GetAge() int
GetAge returns the age from a Swedish personal identity number.
func (*Personnummer) GetDate ¶ added in v3.1.0
func (p *Personnummer) GetDate() time.Time
GetDate returns the date from a Swedish personal identity number.
func (*Personnummer) IsCoordinationNumber ¶
func (p *Personnummer) IsCoordinationNumber() bool
IsCoordinationNumber determine if a Swedish personal identity number is a coordination number or not. Returns true if it's a coordination number.
func (*Personnummer) IsFemale ¶
func (p *Personnummer) IsFemale() bool
IsFemale checks if a Swedish personal identity number is for a female.
func (*Personnummer) IsInterimNumber ¶ added in v3.1.0
func (p *Personnummer) IsInterimNumber() bool
IsInterimNumber determine if a Swedish personal identity number is a interim number or not. Returns true if it's a interim number.
func (*Personnummer) IsMale ¶
func (p *Personnummer) IsMale() bool
IsMale checks if a Swedish personal identity number is for a male. The second argument should be a boolean