Help us shape the future of Go! Take the 2026 Go Developer Survey

sql

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQL_SPLITER          = ";"
	DefaultMySQLTable    = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='DATABASE_NAME';"
	DefaultMySQLDatabase = "SHOW DATABASES;"
	DefaultPGSQLTable    = "SELECT TABLENAME FROM PG_TABLES WHERE SCHEMANAME='public';"
	DefaultMsSQLTable    = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' AND TABLE_CATALOG='DATABASE_NAME';"

	SupportReminder = "history all magic only support @(YYYY) @(YY) @(MM) @(DD) @(hh) @(mm) @(ss)"
	Wildcards       = "*"

	DefaultDoneRecordsFile = "sql.records"
)
View Source
const (
	YEAR = iota
	MONTH
	DAY
	HOUR
	MINUTE
	SECOND
)
View Source
const (
	// 获取符合条件的table
	TABLE = iota
	// 获取符合条件的database
	DATABASE
	// 获取数据库表的总条数
	COUNT
)

Variables

View Source
var MysqlSystemDB = []string{"information_schema", "performance_schema", "mysql", "sys"}

Functions

func NewReader

func NewReader(meta *reader.Meta, conf conf.MapConf) (ret reader.Reader, err error)

func WriteRecordsFile

func WriteRecordsFile(doneFilePath, content string) (err error)

WriteRecordsFile 将当前文件写入donefiel中

Types

type DBRecords

type DBRecords map[string]TableRecords

func (*DBRecords) GetTableRecords

func (dbRecords *DBRecords) GetTableRecords(db string) TableRecords

func (*DBRecords) Reset

func (dbRecords *DBRecords) Reset()

func (*DBRecords) Set

func (dbRecords *DBRecords) Set(value DBRecords)

func (*DBRecords) SetTableRecords

func (dbRecords *DBRecords) SetTableRecords(db string, tableRecords TableRecords)

type DataQuery

type DataQuery struct {
	// contains filtered or unexported fields
}

type Reader

type Reader struct {
	Cron *cron.Cron //定时任务

	CurrentCount int64
	// contains filtered or unexported fields
}

func (*Reader) Close

func (r *Reader) Close() (err error)

func (*Reader) Lag

func (r *Reader) Lag() (rl *LagInfo, err error)

func (*Reader) LoopRun

func (r *Reader) LoopRun()

func (*Reader) Name

func (r *Reader) Name() string

func (*Reader) ReadData

func (r *Reader) ReadData() (Data, int64, error)

func (*Reader) ReadLine

func (r *Reader) ReadLine() (string, error)

func (*Reader) SetMode

func (r *Reader) SetMode(mode string, v interface{}) error

func (*Reader) Source

func (r *Reader) Source() string

func (*Reader) Start

func (r *Reader) Start()

Start 仅调用一次,借用 ReadData 启动,不能在 new 实例的时候启动,会有并发问题

func (*Reader) Status

func (r *Reader) Status() StatsInfo

func (*Reader) SyncMeta

func (r *Reader) SyncMeta()

SyncMeta 从队列取数据时同步队列,作用在于保证数据不重复。

type TableInfo

type TableInfo struct {
	// contains filtered or unexported fields
}

type TableRecords

type TableRecords map[string]TableInfo

func (*TableRecords) GetTableInfo

func (tableRecords *TableRecords) GetTableInfo(table string) TableInfo

func (*TableRecords) Reset

func (tableRecords *TableRecords) Reset()

func (*TableRecords) Set

func (tableRecords *TableRecords) Set(value TableRecords)

func (*TableRecords) SetTableInfo

func (tableRecords *TableRecords) SetTableInfo(table string, tableInfo TableInfo)

Jump to

Keyboard shortcuts

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