config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RootDir added in v0.2.0

func RootDir() string

RootDir returns the default root directory for BHLnames data.

Types

type Config

type Config struct {

	// BHLDumpURL specifies the source for Biodiversity Heritage Library dump
	// files.
	BHLDumpURL string

	// BHLNamesURL specifies the source for BHLindex data (name occurrences and
	// verifications).
	BHLNamesURL string

	// CoLDataURL specifies the source for Catalogue of Life data in Darwin Core
	// Archive format.
	CoLDataURL string

	// DbDatabase is the name of the PostgreSQL database for BHLnames data.
	DbDatabase string

	// DbHost is the hostname or IP address of the PostgreSQL server.
	DbHost string

	// DbUser is the PostgreSQL username with write permissions to the database.
	DbUser string

	// DbPass is the password for `DBUser`.
	DbPass string

	// JobsNum controls the concurrency level for finding references
	// containing specified names.
	JobsNum int

	// PortREST specifies the port number for the BHLnames RESTful service.
	PortREST int

	// RootDir is the base directory for all BHLnames downloaded and extracted
	// files.
	RootDir string

	// DownloadBHLFile is the full path where the downloaded BHL dump
	// (compressed) is stored.
	DownloadBHLFile string

	// DownloadCoLFile is the full path where the downloaded CoL DwCA file is
	// stored.
	DownloadCoLFile string

	// ExtractDir is the directory where BHLnames extracts the contents of the
	// compressed files.
	ExtractDir string

	// DownloadNamesFile is the full path where the downloaded BHLindex Data file
	// is stored.
	DownloadNamesFile string

	// WithCoLDataTrim indicates whether the CoL nomenclatural tables should be
	// cleared and repopulated with fresh CoL data or import will continue from
	// where it was paused.
	WithCoLDataTrim bool

	// WithRebuild determines if BHL or CoL data needs to be re-downloaded and
	// processed. If true, deletes any locally cached data.
	WithRebuild bool
}

Config defines the essential parameters needed for BHLnames functionality.

func New

func New(opts ...Option) Config

New creates a new Config instance with default values.

type Option

type Option func(*Config)

Option enables a functional approach for modifying Config settings.

func OptBHLDumpURL

func OptBHLDumpURL(s string) Option

OptBHLDumpURL sets the URL for BHL dump files.

func OptBHLNamesURL

func OptBHLNamesURL(s string) Option

OptBHLNamesURL sets the URL for BHLindex data.

func OptCoLDataURL

func OptCoLDataURL(s string) Option

OptCoLDataURL sets the URL for the Catalogue of Life data.

func OptDbDatabase added in v0.2.0

func OptDbDatabase(s string) Option

OptDbDatabase sets the name of the PostgreSQL database for BHLnames data.

func OptDbHost

func OptDbHost(s string) Option

OptDbHost sets the hostname or IP address of the PostgreSQL server.

func OptDbPass

func OptDbPass(s string) Option

OptDbPass sets the password for the PostgreSQL user.

func OptDbUser

func OptDbUser(s string) Option

OptDbUser sets the PostgreSQL username with write permissions to the database.

func OptJobsNum

func OptJobsNum(i int) Option

OptJobsNum sets the concurrency level for finding references containing

func OptPortREST

func OptPortREST(i int) Option

OptPortREST sets the port number for the BHLnames RESTful service.

func OptRootDir added in v0.2.0

func OptRootDir(s string) Option

OptRootDir sets the base directory for all BHLnames downloaded and extracted files.

func OptWithCoLDataTrim added in v0.2.0

func OptWithCoLDataTrim(b bool) Option

OptWithCoLDataTrim sets the CoL data trim option.

func OptWithRebuild

func OptWithRebuild(b bool) Option

OptWithRebuild sets the rebuild option.

Jump to

Keyboard shortcuts

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