Documentation
¶
Index ¶
- type Sex
- type SwedishSsn
- func (ssn SwedishSsn) Age() int
- func (ssn SwedishSsn) AgeAt(at time.Time) int
- func (ssn SwedishSsn) IsValid() bool
- func (ssn SwedishSsn) Sex() Sex
- func (ssn SwedishSsn) String() string
- func (ssn SwedishSsn) StringNoSign() string
- func (ssn SwedishSsn) StringShort() string
- func (ssn SwedishSsn) StringShortNoSign() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SwedishSsn ¶
type SwedishSsn struct {
// contains filtered or unexported fields
}
SwedishSsn represents a swedish social security number (personnummer).
func FromString ¶
func FromString(ssn string) (SwedishSsn, error)
FromString parses a SSN as string and creates a SwedishSsn.
func (SwedishSsn) Age ¶
func (ssn SwedishSsn) Age() int
Age calculates the persons age at the current time.
func (SwedishSsn) AgeAt ¶
func (ssn SwedishSsn) AgeAt(at time.Time) int
AgeAt calculates the persons age at a specific time.
func (SwedishSsn) IsValid ¶
func (ssn SwedishSsn) IsValid() bool
IsValid checks that the ssn and control digit is valid.
func (SwedishSsn) String ¶
func (ssn SwedishSsn) String() string
String converts the SSN to a string with 4-digit year with separator sign.
func (SwedishSsn) StringNoSign ¶
func (ssn SwedishSsn) StringNoSign() string
StringNoSign converts the SSN to a string with 4-digit year without separator sign.
func (SwedishSsn) StringShort ¶
func (ssn SwedishSsn) StringShort() string
StringShort converts the SSN to a string with 2-digit year with separator sign.
func (SwedishSsn) StringShortNoSign ¶
func (ssn SwedishSsn) StringShortNoSign() string
StringShortNoSign converts the SSN to a string with 2-digit year without separator sign.