Documentation
¶
Overview ¶
Package postalcode provides parsing and validation for German ZIP codes (Postleitzahl).
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSyntax = errors.New("de/postalcode: postal codes must be 5-digit numbers")
Functions ¶
Types ¶
type PostalCode ¶
type PostalCode string
PostalCode represents a German postal code code (Postleitzahl).
It is a 5-digit string.
func Parse ¶
func Parse(s string) (PostalCode, error)
Parse parses the passed postal code.
If Parse returns without an error, the postal code is considered syntactically valid.
Note that while checking if the postal code actually exists is possible, it is also error-prone, because as soon as a new postal code is assigned, or one is removed, the validation automatically becomes incorrect. Therefore, this package only checks for syntactical validity.
func (PostalCode) MarshalText ¶
func (c PostalCode) MarshalText() ([]byte, error)
func (PostalCode) String ¶
func (c PostalCode) String() string
func (*PostalCode) UnmarshalText ¶
func (c *PostalCode) UnmarshalText(text []byte) error
Click to show internal directories.
Click to hide internal directories.