geocoder

package
v2.0.0-...-c293183 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_PGSQL_OPEN_STR = "user=postgres dbname=points sslmode=disable"
	DEFAULT_MYSQL_OPEN_STR = "points/root/"
	DEFAULT_TEST_OPEN_STR  = "\"\""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapper

type Mapper interface {
	PointsWithinRadius(p *geo.Point, radius int) bool
}

This interface describes a Mapper, which should be a data storage mechanism that can execute interesting queries. Currently, mappers should be able to find points within a radius of an origin point.

type SQLConf

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

Provides a set of configuration variables that describe how to interact with a SQL database.

func GetSQLConf

func GetSQLConf() (*SQLConf, error)

Attempts to read config/geo.yml, and creates a SQLConf as described therein. Returns the DefaultSQLConf if no config/geo.yml is found, or an error if one arises during the process of parsing the configuration file.

func GetSQLConfFromFile

func GetSQLConfFromFile(filename string) (*SQLConf, error)

Attempts to read from the passed in filename and creates a SQLconf as described therin. Retruns the DefaultSQLConf if the file cannot be found, or an error if one arises during the process of parsing the configuration file.

type SQLMapper

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

A Mapper that uses Standard SQL Syntax to perform mapping functions and queries

func HandleWithSQL

func HandleWithSQL() (*SQLMapper, error)

Retrieves the SQL configuration specified in config.yml that resides at the root level of the project. Returns a pointer to a SQLMapper if successful, or an error if there is an issue opening a database connection.

func NewSQLMapper

func NewSQLMapper(filename string, conn *sql.DB) (*SQLMapper, error)

Creates and returns a pointer to a new geo.SQLMapper.

func (*SQLMapper) PointsWithinRadius

func (s *SQLMapper) PointsWithinRadius(p *geo.Point, radius float64) (*sql.Rows, error)

Uses SQL to retrieve all points within the radius (in meters) passed in from the origin point passed in. Original implemenation from : http://www.movable-type.co.uk/scripts/latlong-db.html Returns a pointer to a sql.Rows as a result, or an error if one occurs during the query.

func (*SQLMapper) SqlDbConn

func (s *SQLMapper) SqlDbConn() *sql.DB

Returns a pointer to the SQLMapper's SQL Database Connection.

Jump to

Keyboard shortcuts

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