Documentation ¶
Overview ¶
Package place provides support for managing place data in the database.
Index ¶
- Variables
- type City
- type Info
- type Place
- func (p Place) Add(ctx context.Context, traceID string, plc Info) (Info, error)
- func (p Place) QueryByCategory(ctx context.Context, traceID string, category string) ([]Info, error)
- func (p Place) QueryByCity(ctx context.Context, traceID string, cityID string) ([]Info, error)
- func (p Place) QueryByID(ctx context.Context, traceID string, placeID string) (Info, error)
- func (p Place) QueryByName(ctx context.Context, traceID string, name string) (Info, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrExists = errors.New("place exists") ErrNotFound = errors.New("place not found") )
Set of error variables for CRUD operations.
Functions ¶
This section is empty.
Types ¶
type City ¶
type City struct {
ID string `json:"id"`
}
City is used to capture the city id in relationships.
type Info ¶
type Info struct { ID string `json:"id,omitempty"` Category string `json:"category"` City City `json:"city"` PlaceID string `json:"place_id"` CityName string `json:"city_name"` Name string `json:"name"` Address string `json:"address"` Lat float64 `json:"lat"` Lng float64 `json:"lng"` LocationType []string `json:"location_type"` AvgUserRating float32 `json:"avg_user_rating"` NumberOfRatings int `json:"no_user_rating"` GmapsURL string `json:"gmaps_url"` PhotoReferenceID string `json:"photo_id"` }
Info contains the place data points captured from the API.
type Place ¶
type Place struct {
// contains filtered or unexported fields
}
Place manages the set of API's for place access.
func (Place) Add ¶
Add adds a new place to the database. If the place already exists this function will fail but the found place is returned. If the city is being added, the city with the id from the database is returned.
func (Place) QueryByCategory ¶
func (p Place) QueryByCategory(ctx context.Context, traceID string, category string) ([]Info, error)
QueryByCategory returns the collection of places from the database by the cagtegory name.
func (Place) QueryByCity ¶
QueryByCity returns the collection of places from the database by the city id.