go_regions

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go_regions

go语言实现的省市区街道库(4级),数据更新时间 2025-01-14

💡 安装

go get -u -v github.com/itmisx/go_regions

💡使用

RegionList(pid) 获取区域列表
go_regions.RegionList(0) // id为0时,获取的为省份列表

结果示例

  • id,地区编码
  • name,地区名称
  • level,地区级别 0-省 1-市 2-区 3-街道
[
    {
        "id": 110000, 
        "name": "北京市", 
        "level": 0 
    }, 
    {
        "id": 120000, 
        "name": "天津市", 
        "level": 0
    }, 
    {
        "id": 130000, 
        "name": "河北省", 
        "level": 0
    }
]
RegionInfo获取区域信息
go_regions.RegionInfo(120000)

结果示例

{
    "id": 120000, 
    "name": "天津市", 
    "level": 0
}
RegionName获取区域名称
go_regions.RegionName(120000)

结果示例

天津市

📝 文档

https://pkg.go.dev/github.com/itmisx/go_regions@v0.0.2#pkg-functions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegionInfo

func RegionInfo(id int) *region

func RegionList

func RegionList(pid int) []region

RegionList 地区列表 pid为0时,获取的是省份列表

func RegionName

func RegionName(id int) string

RegionName 获取地区名称

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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