radius

package module
v0.0.0-...-b2d60c6 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 9 Imported by: 0

README

radius

A golang library for finding zip codes within a given radius using postgis.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	ImportZCTAs(r io.Reader) error
	ImportZCTAsFromDBF(fileName string) error
}

func NewManagerImpl

func NewManagerImpl(repository Repository) Manager

type ManagerImpl

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

func (*ManagerImpl) ImportZCTAs

func (m *ManagerImpl) ImportZCTAs(r io.Reader) error

func (*ManagerImpl) ImportZCTAsFromDBF

func (m *ManagerImpl) ImportZCTAsFromDBF(fileName string) error

type Repository

type Repository interface {
	Store(zipCode, point string) error
	FindZipCode(zipCode string) (ZipCode, error)
	FindAdjacent(longitude, latitude, meters float64) ([]ZipCode, error)
}

func NewRepositoryPgx

func NewRepositoryPgx(conn *pgxpool.Pool) (Repository, error)

func NewRepositorySpatialite

func NewRepositorySpatialite(db *sql.DB) (Repository, error)

type RepositoryPgx

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

func (*RepositoryPgx) FindAdjacent

func (r *RepositoryPgx) FindAdjacent(longitude, latitude, meters float64) ([]ZipCode, error)

func (*RepositoryPgx) FindZipCode

func (r *RepositoryPgx) FindZipCode(zipCode string) (ZipCode, error)

func (*RepositoryPgx) Store

func (r *RepositoryPgx) Store(zipCode, point string) error

type RepositorySpatialite

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

func (*RepositorySpatialite) FindAdjacent

func (r *RepositorySpatialite) FindAdjacent(longitude, latitude, meters float64) ([]ZipCode, error)

func (*RepositorySpatialite) FindZipCode

func (r *RepositorySpatialite) FindZipCode(zipCode string) (ZipCode, error)

func (*RepositorySpatialite) Store

func (r *RepositorySpatialite) Store(zipCode, point string) error

type ZipCode

type ZipCode struct {
	ZipCode   string  `json:"zipCode"`
	Longitude float64 `json:"longitude"`
	Latitude  float64 `json:"latitude"`
	Distance  float64 `json:"distance"`
}

Jump to

Keyboard shortcuts

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