config

package
v0.0.0-...-4b09fe0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMySqlConfigFile

func ParseMySqlConfigFile(file_name string) (map[string]string, error)

Types

type Config

type Config struct {
	Addr     string `yaml:"addr"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	Default  string `yaml:"default"`

	Pprof_addr string `yaml:"pprof_addr"`
	LogLevel   string `yaml:"log_level"`

	Nodes []NodeConfig `yaml:"nodes"`

	ShardRule []ShardConfig `yaml:"rules"`
}

func ParseConfigData

func ParseConfigData(data []byte) (*Config, error)

func ParseJHSConfigFile

func ParseJHSConfigFile(fileName string) (*Config, error)

type NodeConfig

type NodeConfig struct {
	Name             string `yaml:"name"`
	DownAfterNoAlive int    `yaml:"down_after_noalive"`
	IdleConns        int    `yaml:"idle_conns"`
	RWSplit          bool   `yaml:"rw_split"`

	User     string `yaml:"user"`
	Password string `yaml:"password"`
	DB       string `yaml:"db"`

	Master string `yaml:"master"`
	Slave  string `yaml:"slave"`
}

type ShardConfig

type ShardConfig struct {
	Table string   `yaml:"table"`
	Key   string   `yaml:"key"`
	Nodes []string `yaml:"nodes"`
	Type  string   `yaml:"type"`
	Range string   `yaml:"range"`
	//by mian
	ShardNum int `yaml:"shard_num"`
}

Jump to

Keyboard shortcuts

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