config

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecodeConfig             = errors.New("failed to decode config file")
	ErrMissingMeilisearchConfig = errors.New("meilisearch configuration is missing")
	ErrAPIUrlRequire            = errors.New("meilisearch api_url is required")
	ErrMissingSourceConfig      = errors.New("source configuration is missing")
	ErrNotSupportedEngine       = errors.New("engine is not supported")
	ErrSourceDatabaseRequire    = errors.New("source database is required")
	ErrMissingBridgeConfig      = errors.New("bridge configuration is missing")
	ErrIndexMapRequire          = errors.New("bridge index map is required")
	ErrIndexNameRequire         = errors.New("bridge index is required")
	ErrCollectionNameRequire    = errors.New("bridge collection is required")
	ErrBridgeDestinationRequire = errors.New("bridge destination is required")
	ErrInvalidPrimaryKey        = errors.New("don't match primary key with field value map")
	ErrPrimaryKeyIsRequire      = errors.New("primary key is required")
	ErrDatabaseHostIsRequired   = errors.New("database host is required")
	ErrDatabasePortIsRequired   = errors.New("database port is required")
	ErrBridgeNameIsRequired     = errors.New("bridge name is required")
)

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	Name        string                      `yaml:"name"`
	Meilisearch *Meilisearch                `yaml:"meilisearch"`
	Database    *Database                   `yaml:"database"`
	IndexMap    map[Collection]*IndexConfig `yaml:"index_map"`
}

type Collection added in v0.2.0

type Collection string

func (Collection) GetCollection added in v0.6.0

func (c Collection) GetCollection() string

func (Collection) GetCollectionAndView added in v0.2.1

func (c Collection) GetCollectionAndView() (col string, view string)

func (Collection) GetView added in v0.2.1

func (c Collection) GetView() string

func (Collection) HasView added in v0.2.1

func (c Collection) HasView() bool

func (Collection) String added in v0.2.0

func (c Collection) String() string

type Config

type Config struct {
	General *General  `yaml:"general"`
	Bridges []*Bridge `yaml:"bridges"`
}

func New

func New(configPath string) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type Database added in v0.3.0

type Database struct {
	Engine       Engine                 `yaml:"engine"`
	Host         string                 `yaml:"host"`
	Port         uint16                 `yaml:"port"`
	User         string                 `yaml:"user"`
	Password     string                 `yaml:"password"`
	Database     string                 `yaml:"database"`
	CustomParams map[string]interface{} `yaml:"custom_params"`
}

type Embedder

type Embedder struct {
	Source           string `json:"source" yaml:"source"`
	ApiKey           string `json:"apiKey,omitempty" yaml:"api_key"`
	Model            string `json:"model,omitempty" yaml:"model"`
	Dimensions       int    `json:"dimensions,omitempty" yaml:"dimensions"`
	DocumentTemplate string `json:"documentTemplate,omitempty" yaml:"document_template"`
}

type Engine

type Engine string
const (
	MONGO    Engine = "mongo"
	MYSQL    Engine = "mysql"
	POSTGRES Engine = "postgres"
	PLUGIN   Engine = "plugin"
)

func (Engine) String

func (e Engine) String() string

type Faceting

type Faceting struct {
	MaxValuesPerFacet int64 `json:"maxValuesPerFacet" yaml:"max_values_per_facet"`
}

type General added in v0.2.2

type General struct {
	TriggerSync      *TriggerSync `yaml:"trigger_sync"`
	AutoBulkInterval int64        `yaml:"auto_bulk_interval"`
	PProf            *PProf       `yaml:"pprof"`
}

type Index added in v0.2.0

type Index string

func (Index) String added in v0.2.0

func (i Index) String() string

type IndexConfig added in v0.3.0

type IndexConfig struct {
	IndexName  string            `yaml:"index_name"`
	PrimaryKey string            `yaml:"primary_key"`
	Fields     map[string]string `yaml:"fields"`
	Settings   *Settings         `yaml:"settings"`
}

type Meilisearch

type Meilisearch struct {
	APIURL string `yaml:"api_url"`
	APIKey string `yaml:"api_key"`
}

type MinWordSizeForTypos

type MinWordSizeForTypos struct {
	OneTypo  int64 `json:"oneTypo,omitempty" yaml:"one_typo"`
	TwoTypos int64 `json:"twoTypos,omitempty" yaml:"two_typos"`
}

type PProf added in v0.2.2

type PProf struct {
	Enable bool   `yaml:"enable"`
	Listen string `yaml:"listen"`
}

type Pagination

type Pagination struct {
	MaxTotalHits int64 `json:"maxTotalHits" yaml:"max_total_hits"`
}

type Settings

type Settings struct {
	RankingRules         []string            `json:"rankingRules,omitempty" yaml:"ranking_rules"`
	DistinctAttribute    *string             `json:"distinctAttribute,omitempty" yaml:"distinct_attribute"`
	SearchableAttributes []string            `json:"searchableAttributes,omitempty" yaml:"searchable_attributes"`
	DisplayedAttributes  []string            `json:"displayedAttributes,omitempty" yaml:"displayed_attributes"`
	StopWords            []string            `json:"stopWords,omitempty" yaml:"stop_words"`
	Synonyms             map[string][]string `json:"synonyms,omitempty" yaml:"synonyms"`
	FilterableAttributes []string            `json:"filterableAttributes,omitempty" yaml:"filterable_attributes"`
	SortableAttributes   []string            `json:"sortableAttributes,omitempty" yaml:"sortable_attributes"`
	TypoTolerance        *TypoTolerance      `json:"typoTolerance,omitempty" yaml:"typo_tolerance"`
	Pagination           *Pagination         `json:"pagination,omitempty" yaml:"pagination"`
	Faceting             *Faceting           `json:"faceting,omitempty" yaml:"faceting"`
	Embedders            map[string]Embedder `json:"embedders,omitempty" yaml:"embedders"`
}

type TriggerSync added in v0.6.0

type TriggerSync struct {
	Token  string `yaml:"token"`
	Listen string `yaml:"listen"`
}

type TypoTolerance

type TypoTolerance struct {
	Enabled             bool                `json:"enabled,omitempty" yaml:"enabled"`
	MinWordSizeForTypos MinWordSizeForTypos `json:"minWordSizeForTypos,omitempty" yaml:"min_word_size_for_typos"`
	DisableOnWords      []string            `json:"disableOnWords,omitempty" yaml:"disable_on_words"`
	DisableOnAttributes []string            `json:"disableOnAttributes,omitempty" yaml:"disable_on_attributes"`
}

Jump to

Keyboard shortcuts

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