config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFile

func IsFile(path string) bool

func LoadConfigBy

func LoadConfigBy(path string, t interface{}) error

Types

type Addr added in v0.0.2

type Addr struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type ClickHouse added in v0.0.2

type ClickHouse struct {
	Username     string  `yaml:"username"`
	Password     string  `yaml:"password"`
	Dbname       string  `yaml:"dbname"`
	Debug        bool    `yaml:"debug"`
	OpenStrategy string  `yaml:"open-strategy"`
	BlockSize    int     `yaml:"block-size"`
	PoolSize     int     `yaml:"pool-size"`
	Compress     int     `yaml:"compress"`
	Timeout      Timeout `yaml:"timeout"`
	Cluster      Cluster `yaml:"cluster"`
	Server       Addr    `yaml:"server"`
}

type Cluster added in v0.0.2

type Cluster struct {
	Open    string `yaml:"open"`
	Servers []Addr `yaml:"servers"`
}

type Config

type Config struct {
	Server     Server     `yaml:"server"`
	Mysql      MysqlConf  `yaml:"mysql"`
	Logger     Logger     `yaml:"logger"`
	Redis      RedisConf  `yaml:"redis"`
	ClickHouse ClickHouse `yaml:"clickhouse"`
}

func LoadConfig

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

type Logger

type Logger struct {
	Level  string `yaml:"level"`
	LogDir string `yaml:"log-dir"`
}

type Mysql

type Mysql struct {
	Host          string `yaml:"host"`
	Port          int    `yaml:"port"`
	Username      string `yaml:"username"`
	Password      string `yaml:"password"`
	Dbname        string `yaml:"dbname"`
	Charset       string `yaml:"charset"`
	ActiveMax     int    `yaml:"active-max"`
	ConnectionMax int    `yaml:"connection-max"`
	Dev           string `yaml:"dev"`
}

type MysqlConf

type MysqlConf struct {
	Master []Mysql
	Slave  []Mysql
}

type Package

type Package struct {
	OpenCheck     bool  `yaml:"open-check"`
	BodyLenOffset int32 `yaml:"body-len-offset"`
	PackageMax    int32 `yaml:"package-max"`
	HeaderLen     int32 `yaml:"header-len"`
}

type Redis

type Redis struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Db       int    `yaml:"db"`
	Dev      string `yaml:"dev"`
}

type RedisConf

type RedisConf struct {
	Master []Redis
	Slave  []Redis
}

type Server

type Server struct {
	Host    string  `yaml:"host"`
	Port    int32   `yaml:"port"`
	Package Package `yaml:"package"`
}

type Timeout added in v0.0.2

type Timeout struct {
	Read  int `yaml:"read"`
	Write int `yaml:"write"`
}

Jump to

Keyboard shortcuts

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