Versions in this module Expand all Collapse all v0 v0.0.7 Apr 8, 2024 Changes in this version type Query + func (q *Query) GetCountyCount(ctx context.Context, provinceName, cityName string) (int, error) v0.0.6 Apr 4, 2024 Changes in this version + func IsCityDistrictCode(code uint32) bool + func IsCountyDistrictCode(code uint32) bool + func IsHongKongMacauTaiwan(name string) bool + func IsMunicipalityCode(code uint32) bool + func IsProvinceDistrictCode(code uint32) bool v0.0.5 Mar 13, 2024 Changes in this version + func CacheMetricFPrintf(w io.Writer) + func GenerateCsv(districtTable *Table, csvFilepath, csvDelimiter string, withCode bool) error + func GenerateJson(districtTable *Table, jsonFilepath string, withIndent bool, ...) error + func GenerateSql(districtTable *Table, sqlFilepath, tableName string) error + func Md5Sum(data string) string + func PerfectNameOfProvincialAdminRegion(name string) string + type CacheMetric struct + AverageAccessTime int64 + EntryCount int64 + EvacuateCount int64 + ExpiredCount int64 + HitCount int64 + HitRate float64 + LookupCount int64 + MissCount int64 + OverwriteCount int64 + TouchedCount int64 + func GetCacheMetric() *CacheMetric + func (c *CacheMetric) String() (string, error) + type CityDistrict struct + Code uint32 + Counties []District + CountyCity bool + CountyDistrictTable map[uint32]District + Level uint32 + Name string + type Code struct + CityCode uint32 + CountyCode uint32 + ProvinceCode uint32 + func (d *Code) Md5Sum() string + type District struct + Code uint32 + Grandparent uint32 + Level uint32 + Name string + Parent uint32 + type Name struct + CityName string + CountyName string + ProvinceName string + func (d *Name) Md5Sum() string + type ProvinceDistrict struct + Cities []CityDistrict + CityDistrictTable map[uint32]CityDistrict + Code uint32 + Level uint32 + Municipality bool + Name string + type Query struct + Db *gorm.DB + ExpireSeconds int + TableName string + func NewQuery(db *gorm.DB, tableName string, expireSeconds int) *Query + func (q *Query) GetDistrictCode(ctx context.Context, name *Name) (*Code, error) + func (q *Query) GetDistrictName(ctx context.Context, code *Code) (*Name, error) + type Table struct + ProvinceDistrictTable map[uint32]ProvinceDistrict + Provinces []ProvinceDistrict + func LoadDistrict(ctx context.Context, filepath string) (*Table, error) Other modules containing this package github.com/eyjian/mooon-district