config

package
v0.0.0-...-25cbce1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(cfg *Config) error

Types

type Config

type Config struct {
	DB1    DBConfig     `yaml:"DB1"`
	DB2    DBConfig     `yaml:"DB2"`
	Server ServerConfig `yaml:"server"`
}

func LoadConfig

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

func (*Config) Validate

func (c *Config) Validate() error

type DBConfig

type DBConfig struct {
	Type     string        `yaml:"type"`
	Host     string        `yaml:"host,omitempty"`
	Port     int           `yaml:"port,omitempty"`
	User     string        `yaml:"user,omitempty"`
	Password string        `yaml:"password,omitempty"`
	DBName   string        `yaml:"dbname,omitempty"`
	Path     string        `yaml:"path,omitempty"` //For SQLite
	Tables   []TableConfig `yaml:"tables"`
}

func (*DBConfig) Validate

func (dbc *DBConfig) Validate() error

type PartitioningConfig

type PartitioningConfig struct {
	Key  string `yaml:"key"`
	Type string `yaml:"type"`
}

func (*PartitioningConfig) Validate

func (pc *PartitioningConfig) Validate() error

type ServerConfig

type ServerConfig struct {
	Port    string `yaml:"port"`
	Prefork bool   `yaml:"prefork"`
}

type ShardingConfig

type ShardingConfig struct {
	Key      string `yaml:"key"`
	Strategy string `yaml:"strategy"`
}

func (*ShardingConfig) Validate

func (sc *ShardingConfig) Validate() error

type TableConfig

type TableConfig struct {
	Name         string              `yaml:"name"`
	PrimaryKey   string              `yaml:"primary_key"`
	Sharding     *ShardingConfig     `yaml:"sharding,omitempty"`
	Partitioning *PartitioningConfig `yaml:"partitioning,omitempty"`
	Sampling     bool                `yaml:"sampling"`
	SampleRate   float64             `yaml:"sample_rate"`
	SampleColumn string              `yaml:"sample_column"`
}

func (*TableConfig) Validate

func (tc *TableConfig) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳