placesdb

package
v0.0.0-...-7265847 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package placesdb provides an abstraction to the database being used to store data about places.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoJson

type GeoJson struct {
	Type        string    `bson:"type,omitempty"`
	Coordinates []float64 `bson:"coordinates"`
}

GeoJson is the format used by the database to encode geographic data structures. More information at: http://geojson.org/

type Place

type Place struct {
	ID                bson.ObjectId `bson:"_id"`
	GoogleMapsPlaceID string        `bson:"gmplaceid"`
	Location          GeoJson       `bson:"loc"`
	Accessibility     []string      `bson:"acc"`
}

A Place object holds the information stored in the database.

type Places

type Places struct {
	// contains filtered or unexported fields
}

Places is a client library which exports methods to access/change information stored in the places database.

func Dial

func Dial(u string, timeout time.Duration, maxRPS, limit int) (*Places, error)

Dial connects to the database identified by the URL u, specifying a timeout for all DB operations. TODO(danielfireman): Use max RPS field.

func (*Places) Get

func (p *Places) Get(txn newrelic.Transaction, placeID string) (*Place, error)

Get synchronously fetches information from the database about a given placeID.

func (*Places) NearbySearch

func (p *Places) NearbySearch(txn newrelic.Transaction, lat, lng float64, radius uint) ([]Place, error)

NearbySearch synchronously fetches all places within the radius, considering lat and lng the center of a circle. radius in expressed in meters.

func (*Places) Put

func (p *Places) Put(txn newrelic.Transaction, placeID string, acc []string, lat, lng float64) error

Put synchronously put the passed-in information into the database.

Jump to

Keyboard shortcuts

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