forked from TrueCloudLab/frostfs-node
[#316] locode: Implement csv UN/LOCODE table
Define csv UN/LOCODE table. Implement iterator over table entries. Implement method that resolves country/subdivision code pair to subdivision name. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
cdd1274e1c
commit
6829048124
3 changed files with 218 additions and 0 deletions
28
pkg/util/locode/table/csv/opts.go
Normal file
28
pkg/util/locode/table/csv/opts.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package csvlocode
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Option sets an optional parameter of Table.
|
||||
type Option func(*options)
|
||||
|
||||
type options struct {
|
||||
mode os.FileMode
|
||||
|
||||
extraPaths []string
|
||||
}
|
||||
|
||||
func defaultOpts() *options {
|
||||
return &options{
|
||||
mode: 0700,
|
||||
}
|
||||
}
|
||||
|
||||
// WithExtraPaths returns option to add extra paths
|
||||
// to UN/LOCODE tables in csv format.
|
||||
func WithExtraPaths(ps ...string) Option {
|
||||
return func(o *options) {
|
||||
o.extraPaths = append(o.extraPaths, ps...)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue