config

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

package config contains information needed to run gnmatcher project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTilda added in v0.3.6

func ConvertTilda(path string) string

ConvertTilda expands paths with `~/` to an actual home directory.

Types

type Config

type Config struct {
	// WorkDir is the main directory for gnmatcher files. It contains
	// bloom filters levenshtein automata trees, key-value stores etc.
	WorkDir string
	// MaxEditDist is the maximal allowed edit distance for levenshtein automata.
	// The number cannot exceed 2, default number is 1. The speed of execution
	// slows down dramatically with the MaxEditDist > 1.
	MaxEditDist int
	// PgHost is a hostname for the PostgreSQL server.
	PgHost string
	// PgPort is the port of PostgreSQL server.
	PgPort int
	// PgUser is the user for the database.
	PgUser string
	// PgPass password to access PostgreSQL server.
	PgPass string
	// PgDB the database name where gnames data is located.
	PgDB string
}

Config collects and stores external configuration data.

func NewConfig

func NewConfig(opts ...Option) Config

NewConfig is a Config constructor that takes external options to update default values to external ones.

func (Config) FiltersDir

func (cnf Config) FiltersDir() string

FiltersDir returns path where to dump/restore serialized bloom filters.

func (Config) StemsDir

func (cnf Config) StemsDir() string

StemsDir returns path where stems key-value store is located

func (Config) TrieDir

func (cnf Config) TrieDir() string

TrieDir returns path where to dump/restore serialized trie.

type Option

type Option func(cnf *Config)

Option is a type of all options for Config.

func OptMaxEditDist

func OptMaxEditDist(i int) Option

OptMaxEditDist sets maximal possible edit distance for fuzzy matching of stemmed canonical forms.

func OptPgDB

func OptPgDB(s string) Option

OptPgDB sets the name of gnames database

func OptPgHost

func OptPgHost(s string) Option

OptPgHost sets the host of gnames database

func OptPgPass

func OptPgPass(s string) Option

OptPgPass sets the password to access gnnames database

func OptPgPort

func OptPgPort(i int) Option

OptPgPort sets the port for gnames database

func OptPgUser

func OptPgUser(s string) Option

OptPgUser sets the user of gnnames database

func OptWorkDir

func OptWorkDir(s string) Option

OptWorkDir sets a directory for key-value stores and temporary files.

Jump to

Keyboard shortcuts

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