config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientType

type ClientType string

ClientType ...

const (
	// ClientTypeRedis ...
	ClientTypeRedis ClientType = "redis"
	// ClientTypeMemcache ...
	ClientTypeMemcache ClientType = "memcache"
)

type Config

type Config struct {
	HTTPPort uint16 `mapstructure:"http_port"`

	EventTableName  string `mapstructure:"event_table_name"`
	OffsetTableName string `mapstructure:"offset_table_name"`

	EventRetentionSize uint32        `mapstructure:"event_retention_size"`
	DBScanDuration     time.Duration `mapstructure:"db_scan_duration"`

	NotifyAccessToken string `mapstructure:"notify_access_token"`

	DBType DBType      `mapstructure:"db_type"`
	MySQL  MySQLConfig `mapstructure:"mysql"`

	ClientType ClientType `mapstructure:"client_type"`

	RedisNumServers int           `mapstructure:"redis_num_servers"`
	RedisServers    []RedisConfig `mapstructure:"-"`

	MemcacheNumServers int              `mapstructure:"memcache_num_servers"`
	MemcacheServers    []MemcacheConfig `mapstructure:"-"`
}

Config ...

func Load

func Load() Config

Load ...

type DBType

type DBType string

DBType ...

const (
	// DBTypeMySQL ...
	DBTypeMySQL DBType = "mysql"
)

type MemcacheConfig added in v0.3.0

type MemcacheConfig struct {
	ID   uint32
	Addr string
}

MemcacheConfig ...

type MySQLConfig

type MySQLConfig struct {
	Host     string `mapstructure:"host"`
	Port     uint16 `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Database string `mapstructure:"database"`
	Options  string `mapstructure:"options"`

	MaxOpenConns    uint32        `mapstructure:"max_open_conns"`
	MaxIdleConns    uint32        `mapstructure:"max_idle_conns"`
	MaxConnIdleTime time.Duration `mapstructure:"max_conn_idle_time"`
}

MySQLConfig ...

func (MySQLConfig) DSN

func (c MySQLConfig) DSN() string

DSN ...

func (MySQLConfig) PrintDSN

func (c MySQLConfig) PrintDSN() string

PrintDSN ...

type RedisConfig

type RedisConfig struct {
	ID   uint32
	Addr string
}

RedisConfig ...

Jump to

Keyboard shortcuts

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