POI

package
v0.0.0-...-8f783ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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 Hour

type Hour uint8

func (Hour) ToString

func (h Hour) ToString() string

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 CreatePlace(name, addr, formattedAddr, businessStatus string, locationType LocationType, openingHours *OpeningHours, placeID string, priceLevel int, rating float32, url string, photo *maps.Photo, userRatingsTotal int, latitude, longitude float64, summary *string) (place Place)

func (*Place) GetAddress

func (place *Place) GetAddress() Address

func (*Place) GetFormattedAddress

func (place *Place) GetFormattedAddress() string

func (*Place) GetHour

func (place *Place) GetHour(day Weekday) string

func (*Place) GetID

func (place *Place) GetID() string

func (*Place) GetLocation

func (place *Place) GetLocation() Location

func (*Place) GetName

func (place *Place) GetName() string

func (*Place) GetPhoto

func (place *Place) GetPhoto() PlacePhoto

func (*Place) GetPriceLevel

func (place *Place) GetPriceLevel() PriceLevel

func (*Place) GetRating

func (place *Place) GetRating() float32

func (*Place) GetStatus

func (place *Place) GetStatus() BusinessStatus

func (*Place) GetSummary

func (place *Place) GetSummary() string

func (*Place) GetType

func (place *Place) GetType() LocationType

func (*Place) GetURL

func (place *Place) GetURL() string

func (*Place) GetUserRatingsTotal

func (place *Place) GetUserRatingsTotal() int

func (*Place) SetAddress

func (place *Place) SetAddress(addr string)

func (*Place) SetFormattedAddress

func (place *Place) SetFormattedAddress(formattedAddress string)

SetFormattedAddress sets a human-readable Address

func (*Place) SetHour

func (place *Place) SetHour(day Weekday, hour string)

func (*Place) SetID

func (place *Place) SetID(id string)

func (*Place) SetLocationCoordinates

func (place *Place) SetLocationCoordinates(coordinates [2]float64)

func (*Place) SetName

func (place *Place) SetName(name string)

func (*Place) SetPhoto

func (place *Place) SetPhoto(photo *maps.Photo)

func (*Place) SetPriceLevel

func (place *Place) SetPriceLevel(priceRange int)

func (*Place) SetRating

func (place *Place) SetRating(rating float32)

func (*Place) SetStatus

func (place *Place) SetStatus(status string)

func (*Place) SetSummary

func (place *Place) SetSummary(summary string)

func (*Place) SetType

func (place *Place) SetType(t LocationType)

func (*Place) SetURL

func (place *Place) SetURL(url string)

func (*Place) SetUserRatingsTotal

func (place *Place) SetUserRatingsTotal(userRatingsTotal int)

type PlaceCategory

type PlaceCategory string

func GetPlaceCategory

func GetPlaceCategory(placeType LocationType) (placeCategory PlaceCategory)

type PlaceIcon

type PlaceIcon string

type PlacePhoto

type PlacePhoto struct {
	// reference from Google Images
	Reference string `bson:"reference"`
	// the maximum height of the image
	Height int `bson:"height"`
	// the maximum width of the image
	Width int `bson:"width"`
}

type PriceLevel

type PriceLevel int

type StayingTime

type StayingTime uint8

func GetStayingTimeForLocationType

func GetStayingTimeForLocationType(locationType LocationType) StayingTime

type TimeInterval

type TimeInterval struct {
	Start Hour `json:"start"`
	End   Hour `json:"end"`
}

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

type Weekday

type Weekday uint8
const (
	DateMonday Weekday = iota
	DateTuesday
	DateWednesday
	DateThursday
	DateFriday
	DateSaturday
	DateSunday
)

func (Weekday) String

func (w Weekday) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL