Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteConfigFile ¶
WriteConfigFile is to write to config file.
Types ¶
type Config ¶
type Config struct { BindIP string `yaml:"bind_ip"` ProxyPort int `yaml:"proxy_port"` AdminPort int `yaml:"admin_port"` LogPath string `yaml:"log_path"` LogLevel string `yaml:"log_level"` LogSQL string `yaml:"log_sql"` SlowLogTime int `yaml:"slow_log_time"` AllowIps []string `yaml:"allow_ips"` Charset string `yaml:"charset"` AllowKillQuery bool `yaml:"allow_kill_query"` Hosts []HostConfig `yaml:"hosts"` Nodes []NodeConfig `yaml:"nodes"` Schemas []SchemaConfig `yaml:"schemas"` // contains filtered or unexported fields }
Config is a global config for saashard.
func ParseConfigData ¶
ParseConfigData is to parse config data.
func ParseConfigFile ¶
ParseConfigFile is to parse config file.
func (*Config) GetNodes ¶
func (config *Config) GetNodes() map[string]*NodeConfig
GetNodes from Nodes
type HostConfig ¶
type HostConfig struct { Name string `yaml:"name"` MaxConnNum int `yaml:"max_conn_num"` DownAfterNoAlive int `yaml:"down_after_noalive"` PingInterval int `yaml:"ping_interval"` User string `yaml:"user"` Password string `yaml:"password"` Master string `yaml:"master"` Slaves []string `yaml:"slaves"` }
HostConfig is a config of data host.
type NodeConfig ¶
type NodeConfig struct { Name string `yaml:"name"` Host string `yaml:"host"` Database string `yaml:"database"` }
NodeConfig is a config of data node.
type SchemaConfig ¶
type SchemaConfig struct { Name string `yaml:"name"` User string `yaml:"user"` Password string `yaml:"password"` MaxRowCount int `yaml:"max_row_count"` ShardKey string `yaml:"shard_key"` ShardAlgo string `yaml:"shard_algo"` Nodes []string `yaml:"nodes"` CheckTableDisabled bool `yaml:"check_table_disabled"` Tables []TableConfig `yaml:"tables"` // contains filtered or unexported fields }
SchemaConfig is a config of schema.
func (*SchemaConfig) GetTables ¶
func (schema *SchemaConfig) GetTables() map[string]*TableConfig
GetTables from Tables
func (*SchemaConfig) ShardEnabled ¶
func (schema *SchemaConfig) ShardEnabled() bool
ShardEnabled to use shard func.
type TableConfig ¶
type TableConfig struct {
Name string `yaml:"name"`
}
TableConfig is a config of table
Click to show internal directories.
Click to hide internal directories.