2019-08-01 11:34:03 -08:00
|
|
|
package geonames
|
|
|
|
|
|
|
|
import "github.com/shopspring/decimal"
|
2019-08-17 11:03:48 +07:00
|
|
|
import "github.com/jmoiron/sqlx"
|
|
|
|
|
|
|
|
type Repository struct {
|
|
|
|
DbConn *sqlx.DB
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewRepository creates a new Repository that defines dependencies for Project.
|
|
|
|
func NewRepository(db *sqlx.DB) *Repository {
|
|
|
|
return &Repository{
|
|
|
|
DbConn: db,
|
|
|
|
}
|
|
|
|
}
|
2019-08-01 11:34:03 -08:00
|
|
|
|
|
|
|
type Geoname struct {
|
2019-08-01 13:45:38 -08:00
|
|
|
CountryCode string // US
|
|
|
|
PostalCode string // 99686
|
|
|
|
PlaceName string // Valdez
|
|
|
|
StateName string // Alaska
|
|
|
|
StateCode string // AK
|
|
|
|
CountyName string // Valdez-Cordova
|
|
|
|
CountyCode string // 261
|
|
|
|
CommunityName string //
|
|
|
|
CommunityCode string //
|
|
|
|
Latitude decimal.Decimal // 61.101
|
|
|
|
Longitude decimal.Decimal // -146.9
|
|
|
|
Accuracy int // 1
|
2019-08-01 11:34:03 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
type Country struct {
|
2019-08-01 13:45:38 -08:00
|
|
|
Code string // US
|
|
|
|
Name string
|
|
|
|
IsoAlpha3 string
|
|
|
|
Capital string
|
|
|
|
CurrencyCode string // .us
|
|
|
|
CurrencyName string // USD Dollar
|
|
|
|
Phone string // 1
|
|
|
|
PostalCodeFormat string // #####-####
|
|
|
|
PostalCodeRegex string // ^\d{5}(-\d{4})?$
|
2019-08-01 11:34:03 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
type Region struct {
|
|
|
|
Code string // AK
|
|
|
|
Name string // Alaska
|
|
|
|
}
|
|
|
|
|
2019-08-01 13:45:38 -08:00
|
|
|
type CountryTimezone struct {
|
|
|
|
CountryCode string // US
|
|
|
|
TimezoneId string // America/Anchorage
|
|
|
|
}
|