func ExistsProcessingFile(path string) (bool, error) {
	_, err := os.Stat(path)
	if err != nil {
		if os.IsNotExist(err) {
			return false, nil
		}
		return false, err
	}
	return true, nil
}
ExistsProcessingFile returns whether the processing file exists.
package index
import (
	"io"
	"io/ioutil"
	"os"
	yaml "gopkg.in/yaml.v2"
)
type Config struct {
	DB          string
	Table       string
	ID          string
	Expressions []string
	Drivers     map[string]map[string]string
}
func NewConfig(
	db, table, id string,
	expressions []string,
	driverID string,
	driverConfig map[string]string,
) *Config {
	cfg := &Config{
		DB:          db,
		Table:       table,
		ID:          id,
		Expressions: expressions,
		Drivers:     make(map[string]map[string]string),
	}
	cfg.Drivers[driverID] = driverConfig
	return cfg
}
func (cfg *Config) Driver(driverID string) map[string]string {
	return cfg.Drivers[driverID]
}
func WriteConfig(w io.Writer, cfg *Config) error {
	data, err := yaml.Marshal(cfg)
	if err != nil {
		return err
	}
	_, err = w.Write(data)
	return err
}
func WriteConfigFile(path string, cfg *Config) error {
	f, err := os.Create(path)
	if err != nil {
		return err
	}
	defer f.Close()
	return WriteConfig(f, cfg)
}
func ReadConfig(r io.Reader) (*Config, error) {
	data, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, err
	}
	var cfg Config
	err = yaml.Unmarshal(data, &cfg)
	return &cfg, err
}
func ReadConfigFile(path string) (*Config, error) {
	f, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer f.Close()
	return ReadConfig(f)
}
func CreateProcessingFile(path string) error {
	f, err := os.Create(path)
	if err != nil {
		return err
	}
	_ = f.Close()
	return nil
}
func WriteProcessingFile(path string, data []byte) error {
	return ioutil.WriteFile(path, data, 0666)
}
func RemoveProcessingFile(path string) error {
	return os.Remove(path)
}