gb2260

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 3 Imported by: 1

README

gb2260

Build Status

go implement https://github.com/cn/GB2260.go

Installation

Get the code:

go get github.com/cn/GB2260.go

or

go get github.com/damonchen/gb2260

Usage

    
import (
    gb2260 "github.com/cn/GB2260.go"
    // or
    // gb2260 "github.com/damonchen/gb2660"
)

gb := gb2260.NewGB2260("")
division := gb.Get("360426")

Spec:

https://github.com/cn/GB2260/blob/api-design/spec.md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Revisions

func Revisions() []string

Types

type Division

type Division struct {
	Code     string `json:"code"`     // The six-digit number of the specific administrative division.
	Name     string `json:"name"`     // The Chinese name of the specific administrative division.
	Revision string `json:"revision"` // Optional. The revision year, and empty means "latest".
	// contains filtered or unexported fields
}

Division 地区

func Search(code string, revisions []string) *Division

Search Division

func (Division) Country

func (div Division) Country() *Division

Country 县

func (Division) Description

func (div Division) Description() string

Description 描述

func (Division) Equal

func (div Division) Equal(other Division) bool

Equal use hash to compare equal

func (Division) IsCountry

func (div Division) IsCountry() bool

IsCountry 是否县

func (Division) IsPrefecture

func (div Division) IsPrefecture() bool

IsPrefecture 是否地区

func (Division) IsProvince

func (div Division) IsProvince() bool

IsProvince 是否省份

func (Division) Prefecture

func (div Division) Prefecture() *Division

Prefecture 地区

func (Division) Province

func (div Division) Province() *Division

Province 省份

func (Division) Stack

func (div Division) Stack() []*Division

Stack 省,地区,县

func (Division) String

func (div Division) String() string

type GB2260

type GB2260 struct {
	Store    map[string]string
	Revision string
}

GB2260 GB2260

func NewGB2260

func NewGB2260(revision string) GB2260

NewGB2260 If revision is not specified, use the latest data.

func (GB2260) Counties

func (g GB2260) Counties(prefectureCode string) []*Division

Counties Return a list of counties in Division data structure. A prefecture_code is a 6-length code that endswith 00. It can also be a 4-length code.

func (GB2260) Get

func (g GB2260) Get(code string) *Division

Get Obtain Division

func (GB2260) Prefectures

func (g GB2260) Prefectures(provinceCode string) []*Division

Prefectures Return a list of prefecture level cities in Division data structure. A province_code is a 6-length province code. It can also be: 2-length code 4-length code that endswith 00

func (GB2260) Provinces

func (g GB2260) Provinces() []*Division

Provinces Return a list of provinces in Division data structure.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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