Documentation ¶
Index ¶
- Constants
- func EncodeNearbySearchRedisKey(placeCategory PlaceCategory, level PriceLevel) string
- func PriceyEatery(placeCategory PlaceCategory, priceLevel PriceLevel) bool
- type Address
- type BusinessStatus
- type ByStartTime
- type Hour
- type Location
- type LocationType
- type OpeningHours
- type Place
- func (place *Place) GetAddress() Address
- func (place *Place) GetFormattedAddress() string
- func (place *Place) GetHour(day Weekday) string
- func (place *Place) GetID() string
- func (place *Place) GetLocation() Location
- func (place *Place) GetName() string
- func (place *Place) GetPhoto() PlacePhoto
- func (place *Place) GetPriceLevel() PriceLevel
- func (place *Place) GetRating() float32
- func (place *Place) GetStatus() BusinessStatus
- func (place *Place) GetSummary() string
- func (place *Place) GetType() LocationType
- func (place *Place) GetURL() string
- func (place *Place) GetUserRatingsTotal() int
- func (place *Place) SetAddress(addr string)
- func (place *Place) SetFormattedAddress(formattedAddress string)
- func (place *Place) SetHour(day Weekday, hour string)
- func (place *Place) SetID(id string)
- func (place *Place) SetLocationCoordinates(coordinates [2]float64)
- func (place *Place) SetName(name string)
- func (place *Place) SetPhoto(photo *maps.Photo)
- func (place *Place) SetPriceLevel(priceRange int)
- func (place *Place) SetRating(rating float32)
- func (place *Place) SetStatus(status string)
- func (place *Place) SetSummary(summary string)
- func (place *Place) SetType(t LocationType)
- func (place *Place) SetURL(url string)
- func (place *Place) SetUserRatingsTotal(userRatingsTotal int)
- type PlaceCategory
- type PlaceIcon
- type PlacePhoto
- type PriceLevel
- type StayingTime
- type TimeInterval
- type Weekday
Constants ¶
View Source
const ( PlaceCategoryVisit = PlaceCategory("Visit") PlaceCategoryEatery = PlaceCategory("Eatery") )
View Source
const ( PlaceIconVisit = PlaceIcon("attractions") PlaceIconEatery = PlaceIcon("restaurant") PlaceIconEmpty = PlaceIcon("") )
View Source
const ( LocationTypeCafe = LocationType("cafe") LocationTypeRestaurant = LocationType("restaurant") LocationTypeMuseum = LocationType("museum") LocationTypeGallery = LocationType("art_gallery") LocationTypeAmusementPark = LocationType("amusement_park") LocationTypePark = LocationType("park") )
View Source
const ( StayingTimeLocationTypeCafe = StayingTime(1) StayingTimeLocationTypeRestaurant = StayingTime(1) StayingTimeLocationTypeMuseum = StayingTime(3) StayingTimeLocationTypeGallery = StayingTime(2) StayingTimeLocationTypeAmusementPark = StayingTime(3) StayingTimeLocationTypePark = StayingTime(2) )
View Source
const ( PriceLevelZero = 0 PriceLevelOne = 1 PriceLevelTwo = 2 PriceLevelThree = 3 PriceLevelFour = 4 PriceLevelDefault = 2 )
Variables ¶
This section is empty.
Functions ¶
func EncodeNearbySearchRedisKey ¶
func EncodeNearbySearchRedisKey(placeCategory PlaceCategory, level PriceLevel) string
EncodeNearbySearchRedisKey generates a Redis Key for Redis nearby search with place category and price info The key includes the price level info for eatery and no price info for visit
func PriceyEatery ¶
func PriceyEatery(placeCategory PlaceCategory, priceLevel PriceLevel) bool
PriceyEatery returns whether a eatery place is expensive based on its price level
Types ¶
type Address ¶
type Address struct { POBox string ExtendedAddr string StreetAddr string Locality string Region string PostalCode string Country string }
Address in adr micro-format example: 665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.
type BusinessStatus ¶
type BusinessStatus string
const ( Operational BusinessStatus = "OPERATIONAL" ClosedTemporarily BusinessStatus = "CLOSED_TEMPORARILY" ClosedPermanently BusinessStatus = "CLOSED_PERMANENTLY" StatusNotAvailable BusinessStatus = "STATUS_NOT_AVAILABLE" )
type ByStartTime ¶
type ByStartTime []TimeInterval
func (ByStartTime) Len ¶
func (timeIntervals ByStartTime) Len() int
func (ByStartTime) Less ¶
func (timeIntervals ByStartTime) Less(i, j int) bool
func (ByStartTime) Swap ¶
func (timeIntervals ByStartTime) Swap(i, j int)
type Location ¶
type Location struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` City string `json:"city"` // name of the city where the location belongs to AdminAreaLevelOne string `json:"adminAreaLevelOne"` // e.g. state names in the United States Country string `json:"country"` // name of the country where the location belongs to }
type LocationType ¶
type LocationType string
func GetPlaceTypes ¶
func GetPlaceTypes(placeCat PlaceCategory) (placeTypes []LocationType)
GetPlaceTypes returns a set of types defined in Google Maps API given a location type
type OpeningHours ¶
type OpeningHours struct {
Hours []string
}
type Place ¶
type Place struct { ID string `bson:"_id"` Name string `bson:"name"` Status BusinessStatus `bson:"status"` LocationType LocationType `bson:"location_type"` Address Address `bson:"address"` FormattedAddress string `bson:"formatted_address"` Location Location `bson:"location"` PriceLevel PriceLevel `bson:"price_level"` Rating float32 `bson:"rating"` Hours [7]string `bson:"hours"` URL string `bson:"url"` Photo PlacePhoto `bson:"photo"` UserRatingsTotal int `bson:"user_ratings_total"` Summary string `bson:"summary"` }
func CreatePlace ¶
func (*Place) GetAddress ¶
func (*Place) GetFormattedAddress ¶
func (*Place) GetLocation ¶
func (*Place) GetPhoto ¶
func (place *Place) GetPhoto() PlacePhoto
func (*Place) GetPriceLevel ¶
func (place *Place) GetPriceLevel() PriceLevel
func (*Place) GetStatus ¶
func (place *Place) GetStatus() BusinessStatus
func (*Place) GetSummary ¶
func (*Place) GetType ¶
func (place *Place) GetType() LocationType
func (*Place) GetUserRatingsTotal ¶
func (*Place) SetAddress ¶
func (*Place) SetFormattedAddress ¶
SetFormattedAddress sets a human-readable Address
func (*Place) SetLocationCoordinates ¶
func (*Place) SetPriceLevel ¶
func (*Place) SetSummary ¶
func (*Place) SetType ¶
func (place *Place) SetType(t LocationType)
func (*Place) SetUserRatingsTotal ¶
type PlaceCategory ¶
type PlaceCategory string
func GetPlaceCategory ¶
func GetPlaceCategory(placeType LocationType) (placeCategory PlaceCategory)
type PlacePhoto ¶
type PriceLevel ¶
type PriceLevel int
type StayingTime ¶
type StayingTime uint8
func GetStayingTimeForLocationType ¶
func GetStayingTimeForLocationType(locationType LocationType) StayingTime
type TimeInterval ¶
func ParseTimeInterval ¶
func ParseTimeInterval(openingHour string) (interval TimeInterval, err error)
ParseTimeInterval returns a TimeInterval with start and end hour in [0-24], given a string of form "Monday: 9:30AM - 8:00PM",
func (*TimeInterval) Inclusive ¶
func (interval *TimeInterval) Inclusive(newInterval *TimeInterval) bool
func (*TimeInterval) Intersect ¶
func (interval *TimeInterval) Intersect(newInterval *TimeInterval) bool
func (*TimeInterval) Serialize ¶
func (interval *TimeInterval) Serialize() string
Click to show internal directories.
Click to hide internal directories.