-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.go
87 lines (69 loc) · 2.32 KB
/
address.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package faker
import "fmt"
// Address returns a full address
func (f Faker) Address() string {
return template("Address", randomElement(f.CurrentLocale().AddressesFormats), f)
}
// City returns a city name
func (f Faker) City() string {
return template("City", randomElement(f.CurrentLocale().CityNamesFormats), f)
}
// StreetName return a street name
func (f Faker) StreetName() string {
return template("StreetName", randomElement(f.CurrentLocale().StreetNamesFormats), f)
}
// StreetAddress return a full street address
func (f Faker) StreetAddress() string {
return template("StreetAddress", randomElement(f.CurrentLocale().StreetAddressesFormats), f)
}
// SecondaryAddress returns a Secondary Address
func (f Faker) SecondaryAddress() string {
return format(template("SecondaryAddress", randomElement(f.CurrentLocale().SecondaryAddressesFormats), f))
}
// BuildingNumber return a number of a building
func (f Faker) BuildingNumber() string {
return format(randomElement(f.CurrentLocale().BuildingNumbers))
}
// ZipCode must return a zip code
func (f Faker) ZipCode() string {
return format(randomElement(f.CurrentLocale().ZipFormats))
}
// StreetSuffix return a Street Suffix
func (f Faker) StreetSuffix() string {
return randomElement(f.CurrentLocale().StreetSuffixes)
}
// CityPrefix return a City Prefix
func (f Faker) CityPrefix() string {
return randomElement(f.CurrentLocale().CityPrefix)
}
// CitySuffix return a City Suffix
func (f Faker) CitySuffix() string {
return randomElement(f.CurrentLocale().CitySuffix)
}
// State returns a state name
func (f Faker) State() string {
return randomElement(f.CurrentLocale().StateNames)
}
// StateAbbr returns a state abbrewviation
func (f Faker) StateAbbr() string {
return randomElement(f.CurrentLocale().StateAbbr)
}
// Country returns a country name
func (f Faker) Country() string {
return randomElement(f.CurrentLocale().CountryNames)
}
// CountryCode returns a ISO Country code
func (f Faker) CountryCode() string {
return randomElement(countryCodes)
}
// Latitude returns an earth latitude
func (f Faker) Latitude() string {
return fmt.Sprintf("%f", geoCordinate()/2)
}
// Longitude returns an earth longitude
func (f Faker) Longitude() string {
return fmt.Sprintf("%f", geoCordinate())
}
func geoCordinate() float64 {
return randomFloatBetween(-180000000, 180000000) / 1000000.0
}