gb2260 v0.6.1 GB2260

Elixir.GB2260 is where data stored.

Summary

Functions

Return batch of structs by list of codes

Return a list of counties in Division data structure

Return county of specific struct

Return true if the struct is county

Return true if the struct is prefecture

Return true if the struct is province

Return prefecture of specific struct

Return a list of prefecture level cities in Division data structure

Return province of specific struct

Return a list of provinces in Division data structure

Functions

batch(list, revision \\ Data.last_revision())

Specs

Return batch of structs by list of codes.

Example

iex> GB2260.batch(["110000", "110100"])
[
  %GB2260.Division{ code: "110000", name: "北京市", revision: "2014" },
  %GB2260.Division{ code: "110100", name: "市辖区", revision: "2014" }
]
iex> GB2260.batch(["110000", "110100"], "2013")
[
  %GB2260.Division{ code: "110000", name: "北京市", revision: "2013" },
  %GB2260.Division{ code: "110100", name: "市辖区", revision: "2013" }
]
counties(division)

Specs

Return a list of counties in Division data structure.

county(division)

Specs

Return county of specific struct.

get(code, revision \\ Data.last_revision())

Get the specific struct.

Example

iex> GB2260.get("110000")
%GB2260.Division{ code: "110000", name: "北京市", revision: "2014" }
iex> GB2260.get("110000", "2013")
%GB2260.Division{ code: "110000", name: "北京市", revision: "2013" }
is_county?(division)

Specs

is_county?(GB2260.Division.t) :: boolean

Return true if the struct is county.

is_prefecture?(division)

Specs

is_prefecture?(GB2260.Division.t) :: boolean

Return true if the struct is prefecture.

is_province?(division)

Specs

is_province?(GB2260.Division.t) :: boolean

Return true if the struct is province.

prefecture(division)

Specs

prefecture(GB2260.Division.t) ::
  GB2260.Division.t |
  nil

Return prefecture of specific struct.

prefectures(division)

Specs

Return a list of prefecture level cities in Division data structure.

province(division)

Return province of specific struct.

provinces(revision \\ Data.last_revision())

Specs

provinces(String.t) :: [GB2260.Division.t]

Return a list of provinces in Division data structure.

start(type, args)