2021-02-08 17:40:36 +00:00
|
|
|
package csvlocode
|
|
|
|
|
|
|
|
import (
|
2021-06-28 14:01:31 +00:00
|
|
|
"io/fs"
|
2021-02-08 17:40:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Option sets an optional parameter of Table.
|
|
|
|
type Option func(*options)
|
|
|
|
|
|
|
|
type options struct {
|
2021-06-28 14:01:31 +00:00
|
|
|
mode fs.FileMode
|
2021-02-08 17:40:36 +00:00
|
|
|
|
|
|
|
extraPaths []string
|
|
|
|
}
|
|
|
|
|
|
|
|
func defaultOpts() *options {
|
|
|
|
return &options{
|
2023-10-31 11:56:55 +00:00
|
|
|
mode: 0o700,
|
2021-02-08 17:40:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// WithExtraPaths returns an option to add extra paths
|
2021-02-08 17:40:36 +00:00
|
|
|
// to UN/LOCODE tables in csv format.
|
|
|
|
func WithExtraPaths(ps ...string) Option {
|
|
|
|
return func(o *options) {
|
|
|
|
o.extraPaths = append(o.extraPaths, ps...)
|
|
|
|
}
|
|
|
|
}
|