index

package
v0.0.0-...-e79d762 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFileName is the name of an index config file.
	ConfigFileName = "config.yml"
	// ProcessingFileName is the name of the processing index file.
	ProcessingFileName = ".processing"
)

Variables

This section is empty.

Functions

func CreateProcessingFile

func CreateProcessingFile(dir string) error

CreateProcessingFile creates a file inside the directory saying whether the index is being created.

func ExistsProcessingFile

func ExistsProcessingFile(dir string) (bool, error)

ExistsProcessingFile returns whether the processing file exists inside an index directory.

func RemoveProcessingFile

func RemoveProcessingFile(dir string) error

RemoveProcessingFile removes the file that says whether the index is still being created.

func WriteConfig

func WriteConfig(w io.Writer, cfg *Config) error

WriteConfig writes the configuration to the passed writer (w).

func WriteConfigFile

func WriteConfigFile(dir string, cfg *Config) error

WriteConfigFile writes the configuration to dir/config.yml file.

Types

type Config

type Config struct {
	DB          string
	Table       string
	ID          string
	Expressions []string
	Drivers     map[string]map[string]string
}

Config represents index configuration

func NewConfig

func NewConfig(db, table, id string,
	expressionHashes []sql.ExpressionHash,
	driverID string,
	driverConfig map[string]string) *Config

NewConfig creates a new Config instance for given driver's configuration

func ReadConfig

func ReadConfig(r io.Reader) (*Config, error)

ReadConfig reads an configuration from the passed reader (r).

func ReadConfigFile

func ReadConfigFile(dir string) (*Config, error)

ReadConfigFile reads an configuration from dir/config.yml file.

func (*Config) Driver

func (cfg *Config) Driver(driverID string) map[string]string

Driver returns an configuration for the particular driverID.

func (*Config) ExpressionHashes

func (cfg *Config) ExpressionHashes() []sql.ExpressionHash

ExpressionHashes returns a slice of ExpressionHash for this configuration. Implementation decodes hex strings into byte slices.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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