cfg

package
v0.0.0-...-cda2c63 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DataChan = make(chan *[]*User, 64)

Functions

func Loadini

func Loadini(filename string, data interface{}) (err error)

解析配置文件

func ParseAge

func ParseAge(u *User)

对age列数据进行清洗

Types

type Config

type Config struct {
	MysqlconfigHost  `ini:"mysql_host"`
	MysqlconfigSlave `ini:"mysql_slave"`
	SqlSyntax        `ini:"sql_syntax"`
}

func (*Config) HostData

func (c *Config) HostData(dbHost *sqlx.DB, dataChanel chan<- *[]*User, parse ...func(*User)) (err error)

查询主库

func (*Config) InitDB

func (c *Config) InitDB() (dbHost, dbSlave *sqlx.DB, err error)

func (*Config) SlaveBak

func (c *Config) SlaveBak(dbSlave *sqlx.DB, dataChanel <-chan *[]*User) (err error)

type MysqlconfigHost

type MysqlconfigHost struct {
	Address  string `ini:"address"`
	Port     int    `ini:"port"`
	Username string `ini:"username"`
	Password string `ini:"password"`
	DB       string `ini:"db"`
	Table    string `ini:"table"`
}

type MysqlconfigSlave

type MysqlconfigSlave struct {
	Address  string `ini:"address"`
	Port     int    `ini:"port"`
	Username string `ini:"username"`
	Password string `ini:"password"`
	DB       string `ini:"db"`
	Table    string `ini:"table"`
}

type SqlSyntax

type SqlSyntax struct {
	HostSelcet  string `ini:"host_selcet"`
	SlaveUpdate string `ini:"slave_update"`
	UpdateTime  int    `ini:"update_time"`
	HostCount   string `ini:"host_count"`
	SendCount   int    `ini:"send_count"`
}

type User

type User struct {
	ID   int           `db:"id"`
	Name string        `db:"names"`
	Age  sql.NullInt64 `db:"age"`
	Src  string        `db:"src"`
}

Jump to

Keyboard shortcuts

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