radius

package module
v0.0.0-...-54574dd Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 6 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
}

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

type Repository

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

func NewRepositoryImpl

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

type RepositoryImpl

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

func (*RepositoryImpl) FindAdjacent

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

func (*RepositoryImpl) FindZipCode

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

func (*RepositoryImpl) Store

func (r *RepositoryImpl) 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