@@ -62,17 +62,19 @@ func (c Continent) HasData() bool {
6262
6363// Location contains data for the location record associated with an IP address.
6464type Location struct {
65- // TimeZone is the time zone associated with location, as specified by
66- // the IANA Time Zone Database (e.g., "America/New_York")
67- TimeZone string `json:"time_zone,omitzero" maxminddb:"time_zone"`
6865// Latitude is the approximate latitude of the location associated with
6966// the IP address. This value is not precise and should not be used to
70- // identify a particular address or household.
71- Latitude float64 `json:"latitude" maxminddb:"latitude"`
67+ // identify a particular address or household. Will be nil if not present
68+ // in the database.
69+ Latitude * float64 `json:"latitude,omitzero" maxminddb:"latitude"`
7270// Longitude is the approximate longitude of the location associated with
7371// the IP address. This value is not precise and should not be used to
74- // identify a particular address or household.
75- Longitude float64 `json:"longitude" maxminddb:"longitude"`
72+ // identify a particular address or household. Will be nil if not present
73+ // in the database.
74+ Longitude * float64 `json:"longitude,omitzero" maxminddb:"longitude"`
75+ // TimeZone is the time zone associated with location, as specified by
76+ // the IANA Time Zone Database (e.g., "America/New_York")
77+ TimeZone string `json:"time_zone,omitzero" maxminddb:"time_zone"`
7678// MetroCode is a metro code for targeting advertisements.
7779//
7880// Deprecated: Metro codes are no longer maintained and should not be used.
@@ -89,6 +91,11 @@ func (l Location) HasData() bool {
8991return l != zeroLocation
9092}
9193
94+ // HasCoordinates returns true if both latitude and longitude are present.
95+ func (l Location )HasCoordinates ()bool {
96+ return l .Latitude != nil && l .Longitude != nil
97+ }
98+
9299// RepresentedCountry contains data for the represented country associated
93100// with an IP address. The represented country is the country represented
94101// by something like a military base or embassy.
@@ -342,15 +349,13 @@ type Enterprise struct {
342349// Continent contains data for the continent record associated with the IP
343350// address.
344351Continent Continent `json:"continent,omitzero" maxminddb:"continent"`
345- // City contains data for the city record associated with the IP address.
346- City EnterpriseCityRecord `json:"city,omitzero" maxminddb:"city"`
347- // Postal contains data for the postal record associated with the IP address.
348- Postal EnterprisePostal `json:"postal,omitzero" maxminddb:"postal"`
349352// Subdivisions contains data for the subdivisions associated with the IP
350353// address. The subdivisions array is ordered from largest to smallest. For
351354// instance, the response for Oxford in the United Kingdom would have England
352355// as the first element and Oxfordshire as the second element.
353356Subdivisions []EnterpriseSubdivision `json:"subdivisions,omitzero" maxminddb:"subdivisions"`
357+ // Postal contains data for the postal record associated with the IP address.
358+ Postal EnterprisePostal `json:"postal,omitzero" maxminddb:"postal"`
354359// RepresentedCountry contains data for the represented country associated
355360// with the IP address. The represented country is the country represented
356361// by something like a military base or embassy.
@@ -363,11 +368,13 @@ type Enterprise struct {
363368// with the IP address. This record represents the country where the ISP has
364369// registered the IP block and may differ from the user's country.
365370RegisteredCountry CountryRecord `json:"registered_country,omitzero" maxminddb:"registered_country"`
366- //Traits containsvarious traits associated with the IP address
367- Traits EnterpriseTraits `json:"traits ,omitzero" maxminddb:"traits "`
371+ //City containsdata for the city record associated with the IP address.
372+ City EnterpriseCityRecord `json:"city ,omitzero" maxminddb:"city "`
368373// Location contains data for the location record associated with the IP
369374// address
370375Location Location `json:"location,omitzero" maxminddb:"location"`
376+ // Traits contains various traits associated with the IP address
377+ Traits EnterpriseTraits `json:"traits,omitzero" maxminddb:"traits"`
371378}
372379
373380// HasData returns true if any GeoIP data was found for the IP in the Enterprise database.