Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
Option sets an optional parameter of Table.
func WithExtraPaths ¶
WithExtraPaths returns option to add extra paths to UN/LOCODE tables in csv format.
type Prm ¶
type Prm struct { // Path to UN/LOCODE csv table. // // Must not be empty. Path string // Path to csv table of UN/LOCODE Subdivisions. // // Must not be empty. SubDivPath string }
Prm groups the required parameters of the Table's constructor.
All values must comply with the requirements imposed on them. Passing incorrect parameter values will result in constructor failure (error or panic depending on the implementation).
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is a descriptor of the UN/LOCODE table in csv format.
For correct operation, Table must be created using the constructor (New) based on the required parameters and optional components. After successful creation, The Table is immediately ready to work through API.
func New ¶
New creates a new instance of the Table.
Panics if at least one value of the parameters is invalid.
The created Table does not require additional initialization and is completely ready for work.
func (*Table) IterateAll ¶
IterateAll scans table record one-by-one, parses UN/LOCODE record from it and passes it to f.
Returns f's errors directly.
func (*Table) SubDivName ¶
SubDivName scans table record to in-memory table (once), and returns subdivision name on country and subdivision codes match.
Returns locodedb.ErrSubDivNotFound if no entry matches.