73 lines
2.7 KiB
Go
73 lines
2.7 KiB
Go
package model
|
|
|
|
type Address struct {
|
|
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
|
CustomerID uint `gorm:"column:b2b_customer_id;not null;index" json:"customer_id"`
|
|
AddressString string `gorm:"column:address_string;not null" json:"address_string"`
|
|
AddressUnparsed *AddressUnparsed `gorm:"-" json:"address_unparsed"`
|
|
CountryID uint `gorm:"column:b2b_country_id;not null" json:"country_id"`
|
|
}
|
|
|
|
func (Address) TableName() string {
|
|
return "b2b_addresses"
|
|
}
|
|
|
|
type AddressUnparsed interface{}
|
|
|
|
// Address template in Poland
|
|
type AddressPL struct {
|
|
PostalCode string `json:"postal_code"` // format: 00-000
|
|
City string `json:"city"` // e.g. Kraków
|
|
Voivodeship string `json:"voivodeship"` // e.g. małopolskie (optional but useful)
|
|
|
|
Street string `json:"street"` // e.g. Marszałkowska
|
|
BuildingNo string `json:"building_no"` // e.g. 10, 221B, 12A
|
|
ApartmentNo string `json:"apartment_no"` // e.g. 5, 12B
|
|
|
|
AddressLine2 string `json:"address_line2"` // optional extra info
|
|
|
|
Recipient string `json:"recipient"` // name/company
|
|
}
|
|
|
|
// Address template in Great Britain
|
|
type AddressGB struct {
|
|
PostalCode string `json:"postal_code"` // e.g. SW1A 1AA
|
|
PostTown string `json:"post_town"` // e.g. London
|
|
County string `json:"county"` // optional
|
|
|
|
Thoroughfare string `json:"thoroughfare"` // street name, e.g. Baker Street
|
|
BuildingNo string `json:"building_no"` // e.g. 221B
|
|
BuildingName string `json:"building_name"` // e.g. Flatiron House
|
|
SubBuilding string `json:"sub_building"` // e.g. Flat 5, Apt 2
|
|
|
|
AddressLine2 string `json:"address_line2"`
|
|
Recipient string `json:"recipient"`
|
|
}
|
|
|
|
// Address template in Czech Republic
|
|
type AddressCZ struct {
|
|
PostalCode string `json:"postal_code"` // usually 110 00 or 11000
|
|
City string `json:"city"` // e.g. Praha
|
|
Region string `json:"region"`
|
|
|
|
Street string `json:"street"` // may be omitted in some village-style addresses
|
|
HouseNumber string `json:"house_number"` // descriptive / conscription no.
|
|
OrientationNumber string `json:"orientation_number"` // optional, often after slash
|
|
|
|
AddressLine2 string `json:"address_line2"`
|
|
Recipient string `json:"recipient"`
|
|
}
|
|
|
|
// Address template in Germany
|
|
type AddressDE struct {
|
|
PostalCode string `json:"postal_code"` // e.g. 10115
|
|
City string `json:"city"` // e.g. Berlin
|
|
State string `json:"state"` // Bundesland, optional
|
|
|
|
Street string `json:"street"` // e.g. Unter den Linden
|
|
HouseNumber string `json:"house_number"` // e.g. 77, 12a
|
|
|
|
AddressLine2 string `json:"address_line2"` // extra details
|
|
Recipient string `json:"recipient"`
|
|
}
|