config

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// CacheDir is the directory where all temporary files are located.
	CacheDir string

	// DownloadDir contains temporary files for download.
	DownloadDir string

	// ExtractDir contains temporary files where original archive is extracted to.
	ExtractDir string

	// SfgaDir contains files of the built SFGA file.
	SfgaDir string

	// LoadFile can be a local file or URl. In cases when there is no
	// stable link to a source's data the LoadFile is used.
	LoadFile string

	// Code provides nomenclatural code setting to use in GNparser.
	// This flag is only important for importing data from text, csv and
	// other ad-hoc files.
	Code nomcode.Code

	// ArchiveDate is used to set 'Issued' field in CoLDP/SFGA metadata.
	ArchiveDate string

	// ArchiveDate is used to set 'Version' firle for CoLDP/SFGA metadata.
	ArchiveVersion string

	// WithVerbose indicates that more information might be shown in the
	// output information. It is only important for listing a short list of
	// supported sources, or providing details about them.
	WithVerbose bool

	// SkipDownload disables source data download and extraction. Useful during
	// development to save time and bandwidth.
	SkipDownload bool

	// ColSep is used when importing CSV/TSV/PSV files. By default it is empty
	// and is determined automatically.
	ColSep string

	// WithoutQuotes can be used to parse correctly tab- or pipe-delimited
	// files where fields never escaped by quotes.
	WithoutQuotes bool

	// BadRow sets how to process rows with wrong number of fields in CSV
	// files. By default it is set to process such rows. Other options are
	// to return an error, or skip them.
	BadRow gnfmt.BadRow

	// JobsNum sets the number of concurrent jobs to set, if it is
	// needed.
	JobsNum int

	// BatchSize determines the size of slices to import into SFGA.
	BatchSize int

	// WithZipOutput indicates that zipped archives have to be created.
	WithZipOutput bool
}

func New

func New(opts ...Option) Config

type Option

type Option func(*Config)

Option is the type for all option functions available to modify configuration.

func OptArchiveDate

func OptArchiveDate(s string) Option

func OptArchiveVersion

func OptArchiveVersion(s string) Option

func OptBadRow

func OptBadRow(br gnfmt.BadRow) Option

func OptCacheDir

func OptCacheDir(s string) Option

func OptCode

func OptCode(code nomcode.Code) Option

func OptColSep

func OptColSep(s string) Option

func OptLocalFile

func OptLocalFile(s string) Option

func OptSkipDownload

func OptSkipDownload(b bool) Option

func OptWithVerbose

func OptWithVerbose(b bool) Option

func OptWithZipOutput

func OptWithZipOutput(b bool) Option

func OptWithoutQuotes

func OptWithoutQuotes(b bool) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL