mada

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const PORT = 8010

Variables

View Source
var Assets embed.FS
View Source
var DATABASE_PATH string = filepath.Join(CreateConfigDir(), "mada.bleve")

Functions

func CreateConfigDir

func CreateConfigDir() string

func CreateOrOpenBleve

func CreateOrOpenBleve() (bleve.Index, error)

func FormatOrOpenCommuneInBrowser added in v0.3.2

func FormatOrOpenCommuneInBrowser(db *sql.DB, index bleve.Index, commune *types.Commune, openInBrowser, outputInJSON bool)

func FormatOrOpenDistrictInBrowser added in v0.3.2

func FormatOrOpenDistrictInBrowser(db *sql.DB, index bleve.Index, district *types.District, openInBrowser, outputInJSON bool)

func FormatOrOpenFokontanyInBrowser added in v0.3.2

func FormatOrOpenFokontanyInBrowser(db *sql.DB, index bleve.Index, fokontany *types.Fokontany, openInBrowser, outputInJSON bool)

func FormatOrOpenRegionInBrowser added in v0.3.2

func FormatOrOpenRegionInBrowser(db *sql.DB, index bleve.Index, region *types.Region, openInBrowser, outputInJSON bool)

func FormatResultOrOpenInBrowser added in v0.3.2

func FormatResultOrOpenInBrowser(db *sql.DB, index bleve.Index, searchResults *bleve.SearchResult, openInBrowser, outputInJSON bool)

func FormatSearchResultOrOpenInBrowser added in v0.3.2

func FormatSearchResultOrOpenInBrowser(db *sql.DB, index bleve.Index, searchResults *types.SearchResult, opt types.SearchOptions)

func FormatSearchResults added in v0.3.2

func FormatSearchResults(searchResults *types.SearchResult)

func Init

func Init(db *sql.DB) (bleve.Index, error)

func InitializeBleve

func InitializeBleve(db *sql.DB) (bleve.Index, error)

func NewCommuneService

func NewCommuneService(db *sql.DB, index bleve.Index) svc.CommuneSvc

func NewDistrictService

func NewDistrictService(db *sql.DB, index bleve.Index) svc.DistrictSvc

func NewFokontanyService

func NewFokontanyService(db *sql.DB, index bleve.Index) svc.FokontanySvc

func NewRegionService

func NewRegionService(db *sql.DB, index bleve.Index) svc.RegionSvc

func NewSearchService added in v0.3.2

func NewSearchService(db *sql.DB, index bleve.Index) svc.SearchSvc

func OpenDatabaseConnection added in v0.3.2

func OpenDatabaseConnection() (*sql.DB, error)

func OpenPostgresConnection added in v0.2.0

func OpenPostgresConnection() (*sql.DB, error)

func OpenSQLiteConnection

func OpenSQLiteConnection() (*sql.DB, error)

func StartHttpServer added in v0.3.2

func StartHttpServer(db *sql.DB, index bleve.Index)

Types

type CommuneService

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

func (*CommuneService) Count added in v0.3.2

func (c *CommuneService) Count() (count int, err error)

func (*CommuneService) List

func (c *CommuneService) List(skip, limit int) (*bleve.SearchResult, error)

func (*CommuneService) ShowCommune

func (c *CommuneService) ShowCommune(id string) (*types.Commune, error)

type DistrictService

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

func (*DistrictService) Count added in v0.3.2

func (d *DistrictService) Count() (c int, err error)

func (*DistrictService) List

func (d *DistrictService) List(skip, limit int) (*bleve.SearchResult, error)

func (*DistrictService) ShowDistrict

func (d *DistrictService) ShowDistrict(id string) (*types.District, error)

type Feature added in v0.4.0

type Feature struct {
	Geometry   Geometry               `json:"geometry"`
	Properties map[string]interface{} `json:"properties"`
}

type FeatureCollection added in v0.4.0

type FeatureCollection struct {
	Type     string    `json:"type"`
	Features []Feature `json:"features"`
}

type FokontanyService

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

func (*FokontanyService) Count added in v0.3.2

func (f *FokontanyService) Count() (c int, err error)

func (*FokontanyService) List

func (f *FokontanyService) List(skip, limit int) (*bleve.SearchResult, error)

func (*FokontanyService) ShowFokontany

func (f *FokontanyService) ShowFokontany(id string) (*types.Fokontany, error)

type Geometry

type Geometry struct {
	Type        string           `json:"type"`
	Coordinates [][][]geom.Coord `json:"coordinates"`
}

type Polygon

type Polygon struct {
	Type      string   `json:"type"`
	Name      string   `json:"name"`
	Country   string   `json:"country"`
	Region    string   `json:"region"`
	District  string   `json:"district"`
	Commune   string   `json:"commune"`
	Fokontany string   `json:"fokontany"`
	Geometry  Geometry `json:"geometry"`
	Province  string   `json:"province"`
}

type Properties

type Properties struct {
	Adm0en    string `mapstructure:"ADM0_EN"`
	Adm0type  string `mapstructure:"ADM0_TYPE"`
	Adm1en    string `mapstructure:"ADM1_EN"`
	Adm1type  string `mapstructure:"ADM1_TYPE"`
	Adm2en    string `mapstructure:"ADM2_EN"`
	Adm2type  string `mapstructure:"ADM2_TYPE"`
	Adm3en    string `mapstructure:"ADM3_EN"`
	Adm3type  string `mapstructure:"ADM3_TYPE"`
	Adm4en    string `mapstructure:"ADM4_EN"`
	Adm4type  string `mapstructure:"ADM4_TYPE"`
	OldProvin string `mapstructure:"OLD_PROVIN"`
}

type RegionService

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

func (*RegionService) Count added in v0.3.2

func (r *RegionService) Count() (c int, err error)

func (*RegionService) List

func (r *RegionService) List(skip, limit int) (*bleve.SearchResult, error)

func (*RegionService) ShowRegion

func (r *RegionService) ShowRegion(id string) (*types.Region, error)

type SearchService added in v0.3.2

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

func (*SearchService) Search added in v0.3.2

func (s *SearchService) Search(term string, opt types.SearchOptions) (*types.SearchResult, error)

func (*SearchService) SearchPoint added in v0.3.2

func (s *SearchService) SearchPoint(term string, opt types.SearchOptions) (result *types.SearchResult, err error)

Jump to

Keyboard shortcuts

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