GB2260.Division
Elixir.GB2260.Division provides a struct.
Summary
Functions
Return batch of structs by list of codes
Build a struct of GB2260.Division
Return all counties of province or prefecture
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 all prefectures of province
Return province of specific struct
Types
Functions
Specs
batch([String.t], non_neg_integer) :: [GB2260.Division.t]
Return batch of structs by list of codes.
Example
iex> GB2260.Division.batch(["110000", "110100"])
[
%GB2260.Division{ code: "110000", name: "北京市", revision: 2014 },
%GB2260.Division{ code: "110100", name: "市辖区", revision: 2014 }
]
iex> GB2260.Division.batch(["110000", "110100"], 2013)
[
%GB2260.Division{ code: "110000", name: "北京市", revision: 2013 },
%GB2260.Division{ code: "110100", name: "市辖区", revision: 2013 }
]
Specs
build(String.t, String.t, non_neg_integer) :: GB2260.Division.t
Build a struct of GB2260.Division
.
Example
iex> GB2260.Division.build("110000", "北京市")
%GB2260.Division{ code: "110000", name: "北京市", revision: 2014 }
iex> GB2260.Division.build("110000", "北京市", 2013)
%GB2260.Division{ code: "110000", name: "北京市", revision: 2013 }
Specs
counties(GB2260.Division.t) :: [GB2260.Division.t]
Return all counties of province or prefecture.
Specs
county(GB2260.Division.t) :: GB2260.Division.t | nil
Return county of specific struct.
Specs
get(String.t, non_neg_integer) :: GB2260.Division.t
Get the specific struct.
Example
iex> GB2260.Division.get("110000")
%GB2260.Division{ code: "110000", name: "北京市", revision: 2014 }
iex> GB2260.Division.get("110000", 2013)
%GB2260.Division{ code: "110000", name: "北京市", revision: 2013 }
Specs
is_county?(GB2260.Division.Division.t) :: boolean
Return true if the struct is county.
Specs
is_prefecture?(GB2260.Division.Division.t) :: boolean
Return true if the struct is prefecture.
Specs
is_province?(GB2260.Division.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 all prefectures of province.
Specs
province(GB2260.Division.t) :: GB2260.Division.t
Return province of specific struct.