geocode

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

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 20 Imported by: 1

README

geocode

GeoCode resources for https://github.com/ecletus framework

Documentation

Index

Constants

View Source
const (
	COUNTRY = "Country"
	REGION  = "Region"

	ResourceCountryID = "GeoCode/Country"
	ResourceRegionsID = ResourceCountryID + ".Regions"

	KeyDefaultCountryID = "default_country_id"
	KeyCountryID        = "country_id"
)

Variables

View Source
var PKG = path_helpers.GetCalledDir()

Functions

func Import

func Import(db *aorm.DB, fs assetfsapi.Interface) (err error)

func InitRegionMeta

func InitRegionMeta(setup func(country, region *admin.Meta) error, res *admin.Resource, regionMeta ...*admin.Meta) error

func InitResource

func InitResource(Admin *admin.Admin) *admin.Resource

func Migrate

func Migrate(db *aorm.DB, fs assetfsapi.Interface) error

Types

type CdhCountryCode

type CdhCountryCode struct {
	Code2           string `aorm:"size:2;primary_key"`
	CountryName     string `aorm:"size:255"`
	AltNames        string `aorm:"size:255"`
	Code3           string `aorm:"size:3"`
	IsoCc           int
	FipsCode        string `aorm:"size:10"`
	FipsCountryName string `aorm:"size:50"`
	UnRegion        string `aorm:"size:50"`
	UnSubRegion     string `aorm:"size:50"`
	CdhID           int
	Comments        string `aorm:"size:255"`
	Lat             string `aorm:"size:10"`
	Lng             string `aorm:"size:10"`
}

type CdhStateCode

type CdhStateCode struct {
	CountryID    string `aorm:"size:5"`
	CountryName  string `aorm:"size:255"`
	CountryCode2 string `aorm:"size:2"`
	CountryCode3 string `aorm:"size:3"`
	AltNames     string `aorm:"size:255"`
	Subdiv       string `aorm:"size:10"`
	SubdivID     string `aorm:"size:10;primary_key"`
	LevelName    string `aorm:"size:255"`
	SubdivName   string `aorm:"size:255"`
	SubdivStar   string `aorm:"size:255"`
}

type Country

type Country struct {
	ID       string    `aorm:"size:10;primary_key"`
	Name     string    `aorm:"index;size:255"`
	AltNames string    `aorm:"size:255"`
	Code2    string    `aorm:"index;size:2"`
	Code3    string    `aorm:"index;size:3"`
	Regions  []*Region `aorm:"foreignkey:CountryID"`
}

func (*Country) BasicLabel

func (c *Country) BasicLabel() string

func (*Country) GetID

func (c *Country) GetID() aorm.ID

func (*Country) GetIcon

func (c *Country) GetIcon() string

func (*Country) Stringify

func (c *Country) Stringify() string

type Data

type Data struct {
	CdhCountryCodes []*CdhCountryCode
	CdhStateCodes   []*CdhStateCode
	Country         []*Country
	Region          []*Region
}

func LoadData

func LoadData() *Data

func (*Data) Store

func (this *Data) Store(db *aorm.DB) (err error)

type Plugin

type Plugin struct {
	db.DBNames
	plug.EventDispatcher
	admin_plugin.AdminNames
	// contains filtered or unexported fields
}

func (*Plugin) Init

func (p *Plugin) Init()

func (*Plugin) OnRegister

func (p *Plugin) OnRegister()

type Region

type Region struct {
	ID        string   `aorm:"size:255;primary_key"`
	CountryID string   `aorm:"size:10;index"`
	Country   *Country `json:"-" aorm:"preload:*"`
	Name      string   `aorm:"size:255;index"`
	AltNames  string   `aorm:"size:255"`
	Level     string   `aorm:"size:50;index"`
}

func (*Region) GetAormInlinePreloadFields

func (*Region) GetAormInlinePreloadFields() []string

func (*Region) GetID

func (c *Region) GetID() aorm.ID

func (*Region) Stringify

func (c *Region) Stringify() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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