Documentation ¶
Overview ¶
Package tin provides parsing and validation for German Tax Identification Numbers (Steuerliche Identifikationsnummer).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrLength = errors.New("de/tin: tax ids must be 11 digits long") ErrSyntax = errors.New("de/tin: tax ids must only contain digits, and may not start with 0") // ErrRepetition signifies that the parser found a number that appears // more than three times, or that it found two numbers that appear // more than once. ErrRepetition = errors.New("de/tin: tax ids may not contain the same digit more than three times") ErrCheckDigit = errors.New("de/tin: invalid check digit") )
Functions ¶
func IsValid ¶
IsValid validates that s represents a syntactically valid German tax id.
Spaces are ignored.
func IsValidNum ¶
IsValidNum is the same as IsValid, but takes a number instead of a string.
Types ¶
type TIN ¶
type TIN uint64
TIN is a German Tax Identification Number (Steuerliche Identifikationsnummer).
It does not contain any spaces.
func Parse ¶
Parse parses the passed German tax id.
Spaces and '/' are ignored.
If Parse returns without an error, the tax id is considered syntactically valid.
func (TIN) MarshalText ¶
func (TIN) String ¶
String returns a human-readable representation of the tax ID, by separating the tax ID into its parts.
The returned string is in the format "XX XXX XXX XXX".
If the TIN is invalid, it is returned as is.
It is guaranteed that for any valid TIN, the returned string can be parsed back into the same TIN.