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
Get the 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
Specs
batch([String.t], String.t) :: [GB2260.Division.t]
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" }
]
Specs
counties(GB2260.Division.t) :: [GB2260.Division.t]
Return a list of counties in Division
data structure.
Specs
county(GB2260.Division.t) :: GB2260.Division.t | nil
Return county of specific struct.
Specs
get(String.t, String.t) :: GB2260.Division.t
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" }
Specs
is_county?(GB2260.Division.t) :: boolean
Return true if the struct is county.
Specs
is_prefecture?(GB2260.Division.t) :: boolean
Return true if the struct is prefecture.
Specs
is_province?(GB2260.Division.t) :: boolean
Return true if the struct is province.
Specs
prefecture(GB2260.Division.t) ::
GB2260.Division.t |
nil
Return prefecture of specific struct.
Specs
prefectures(GB2260.Division.t) :: [GB2260.Division.t]
Return a list of prefecture level cities in Division
data structure.
Specs
province(GB2260.Division.t) :: GB2260.Division.t
Return province of specific struct.
Specs
provinces(String.t) :: [GB2260.Division.t]
Return a list of provinces in Division
data structure.