config

package
v0.0.0-...-ced2ee9 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MYSQL_HOST           = "127.0.0.1"
	MYSQL_PORT           = 3306
	MYSQL_USERNAME       = "root"
	MYSQL_PASSWORD       = "root"
	MYSQL_SCHEMA         = ""
	MYSQL_AUTO_COMMIT    = true
	MYSQL_MAX_OPEN_CONNS = 100
	MYSQL_MAX_IDEL_CONNS = 100
	MYSQL_CHARSET        = "utf8mb4"
	MYSQL_TIMEOUT        = 10
)
View Source
const (
	LISTEN_HOST = "0.0.0.0"
	LISTEN_PORT = 19527
)
View Source
const (
	RULE_NAME_LENGTH = 64
)

Variables

This section is empty.

Functions

func LogDefautConfig

func LogDefautConfig() string

Types

type MySQLConfig

type MySQLConfig struct {
	Username          string `toml:"username"`
	Password          string `toml:"password"`
	Database          string `toml:"database"`
	Charset           string `toml:"charset"`
	Host              string `toml:"host"`
	Timeout           int    `toml:"timeout"`
	Port              int    `toml:"port"`
	MaxOpenConns      int    `toml:"max_open_conns"`
	MaxIdelConns      int    `toml:"max_idel_conns"`
	AllowOldPasswords int    `toml:"allow_old_passwords"`
	AutoCommit        bool   `toml:"auto_commit"`
}

func NewMySQLConfig

func NewMySQLConfig(
	host string,
	port int,
	username string,
	password string,
	database string,
	charset string,
	autoCommit bool,
	timeout int,
	maxOpenConns int,
	maxIdelConns int,
) *MySQLConfig
新建一个数据库执行器

Params:

host: ip
port: 端口
username: 链接数据库用户名
password: 链接数据库密码
database: 要操作的数据库

func (*MySQLConfig) Check

func (this *MySQLConfig) Check() error

func (*MySQLConfig) GetDataSource

func (this *MySQLConfig) GetDataSource() string

func (*MySQLConfig) SupDefault

func (this *MySQLConfig) SupDefault()

补充默认值

type RuleConfig

type RuleConfig struct {
	// 通用名字长度
	RuleNameLength int `json:"rule_name_length" form:"rule_name_length"`
}

func (*RuleConfig) Clone

func (this *RuleConfig) Clone() *RuleConfig

type StartConfig

type StartConfig struct {
	ListenHost string `json:"listen_host" form:"listen_host"`
	ListenPort int    `json:"listen_port" form:"listen_port"`
	*RuleConfig
}

func NewStartConfig

func NewStartConfig() *StartConfig

func (*StartConfig) Addr

func (this *StartConfig) Addr() string

Jump to

Keyboard shortcuts

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