config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

config.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkConfig

type BulkConfig struct {
	Status          bool `mapstructure:"status"`
	BatchSize       int  `mapstructure:"batch_size"`
	FlushInterval   int  `mapstructure:"flush_interval"`
	MaxRetries      int  `mapstructure:"max_retries"`
	ConcurrentFlush bool `mapstructure:"concurrent_flush"`
}

BulkConfig holds bulk operation configuration

type CircuitConfig

type CircuitConfig struct {
	Status       bool  `mapstructure:"status"`        // Enable/disable circuit breaker
	Threshold    int64 `mapstructure:"threshold"`     // Number of failures before opening
	ResetTimeout int   `mapstructure:"reset_timeout"` // Time in seconds to wait before reset
	MaxHalfOpen  int32 `mapstructure:"max_half_open"` // Max concurrent requests in half-open state
}

type Config

type Config struct {
	Redis   RedisConfig   `mapstructure:"redis"`
	Pool    PoolConfig    `mapstructure:"pool"`
	Bulk    BulkConfig    `mapstructure:"bulk"`
	Circuit CircuitConfig `mapstructure:"circuit"`
	Logging LoggingConfig `mapstructure:"logging"`
}

func Load

func Load(path string) (*Config, error)

func LoadConfig

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

type LoggingConfig

type LoggingConfig struct {
	Level    string `mapstructure:"level"`
	Format   string `mapstructure:"format"`
	Output   string `mapstructure:"output"`
	FilePath string `mapstructure:"file_path"`
}

LoggingConfig holds logging configuration

type PoolConfig

type PoolConfig struct {
	Status      bool `mapstructure:"status"`
	Size        int  `mapstructure:"size"`
	MinIdle     int  `mapstructure:"min_idle"`
	MaxIdleTime int  `mapstructure:"max_idle_time"`
	WaitTimeout int  `mapstructure:"wait_timeout"`
}

PoolConfig holds connection pool configuration

type RedisConfig

type RedisConfig struct {
	Host                string        `mapstructure:"host"`
	Port                string        `mapstructure:"port"`
	Password            string        `mapstructure:"password"`
	DB                  string        `mapstructure:"db"`
	KeyPrefix           string        `mapstructure:"key_prefix"`
	Timeout             int           `mapstructure:"timeout"`
	HashKeys            bool          `mapstructure:"hash_keys"`
	HealthCheckInterval int           `mapstructure:"health_check_interval"`
	RetryAttempts       int           `mapstructure:"retry_attempts"`
	RetryDelay          time.Duration `mapstructure:"retry_delay"`
	MaxRetryBackoff     time.Duration `mapstructure:"max_retry_backoff"`
}

RedisConfig holds Redis-specific configuration

Jump to

Keyboard shortcuts

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