Documentation ¶
Index ¶
- Constants
- func CheckMagic(rawSql string) (valid bool)
- func CompareRemainStr(target, magicRemainStr, magicRet string, magicRemainIndex []int) bool
- func CompareTime(target, match string, timeStart, timeEnd []int, min bool) (valid bool)
- func CompareWithStartTime(data models.Data, timestampKey string, startTime time.Time) (int, bool)
- func CompareWithStartTimeInt(data models.Data, timestampKey string, startTimeInt int64) (int, bool)
- func CompareWithStartTimeStr(data models.Data, timestampKey, startTimeStr string) (int, bool)
- func Contains(slice []string, str string) bool
- func ConvertBool(v interface{}) (bool, error)
- func ConvertDate(v interface{}) (time.Time, error)
- func ConvertFloat(v interface{}) (float64, error)
- func ConvertLong(v interface{}) (int64, error)
- func ConvertMagicIndex(magic string, now time.Time) (Ret string, index int)
- func ConvertScanArgs(data models.Data, scanArg interface{}, column, runnerName, name string, ...) (int64, error)
- func ConvertString(v interface{}) (string, error)
- func ConvertUUID(v interface{}) (string, error)
- func EqualTime(target, magicRet string, timeStart, timeEnd []int) (valid bool)
- func GetInitScans(length int, rows *sql.Rows, schemas map[string]string, runnerName, name string) (scanArgs []interface{}, nochoiced []bool)
- func GetOffsetIndex(offsetKey string, columns []string) int
- func GetOffsetIndexWithTimeStamp(offsetKey, timestampKey string, columns []string) int
- func GetRemainStr(origin string, magicRemainIndex []int) (remainStr string)
- func GetTimeFromArgs(offsetKeyIndex int, scanArgs []interface{}) (time.Time, bool)
- func GetTimeFromData(data models.Data, timestampKey string) (time.Time, bool)
- func GetTimeIntFromArgs(offsetKeyIndex int, scanArgs []interface{}) (int64, bool)
- func GetTimeIntFromData(data models.Data, timestampKey string) (int64, bool)
- func GetTimeStrFromData(data models.Data, timestampKey string) (string, bool)
- func OpenSql(dbtype, connectStr string) (db *sql.DB, err error)
- func QueryNumber(tsql string, db *sql.DB) (int64, error)
- func RemoveWildcards(checkWildcards string, length int) int
- func RestoreMeta(meta *reader.Meta, rawSqls string, magicLagDur time.Duration) (offsets []int64, sqls []string, omitMeta bool)
- func RestoreSqls(meta *reader.Meta) map[string]string
- func RestoreTimestampIntOffset(doneFilePath string) (int64, map[string]string, error)
- func RestoreTimestampOffset(doneFilePath string) (time.Time, map[string]string, error)
- func RestoreTimestampStrOffset(doneFilePath string) (string, map[string]string, error)
- func SchemaCheck(rawSchemas []string) (schemas map[string]string, err error)
- func UpdateSqls(rawsqls string, now time.Time) []string
- func WriteCacheMap(doneFilePath string, cache map[string]string) (err error)
- func WriteRecordsFile(doneFilePath, content string) (err error)
- func WriteSqlsFile(doneFilePath, content string) (err error)
- func WriteTimestampOffset(doneFilePath, content string) (err error)
- type ByJson
- type DBRecords
- func (dbRecords *DBRecords) GetTableRecords(db string) TableRecords
- func (dbRecords *DBRecords) Reset()
- func (dbRecords *DBRecords) Set(value DBRecords)
- func (dbRecords *DBRecords) SetTableInfo(db, table string, tableInfo TableInfo)
- func (dbRecords *DBRecords) SetTableRecords(db string, tableRecords TableRecords)
- type MagicRes
- type ReadInfo
- type SyncDBRecords
- func (syncDBRecords *SyncDBRecords) CheckDoneRecords(target, curDB string) bool
- func (syncDBRecords *SyncDBRecords) GetDBRecords() DBRecords
- func (syncDBRecords *SyncDBRecords) GetTableRecords(db string) TableRecords
- func (syncDBRecords *SyncDBRecords) Reset()
- func (dbRecords *SyncDBRecords) RestoreRecordsFile(meta *reader.Meta) (lastDB, lastTable string, omitDoneDBRecords bool)
- func (syncDBRecords *SyncDBRecords) SetTableInfo(db, table string, tableInfo TableInfo)
- func (syncDBRecords *SyncDBRecords) SetTableRecords(db string, tableRecords TableRecords)
- type TableInfo
- type TableRecords
- func (tableRecords *TableRecords) GetTable() map[string]TableInfo
- func (tableRecords *TableRecords) GetTableInfo(table string) TableInfo
- func (tableRecords *TableRecords) Reset()
- func (tableRecords *TableRecords) RestoreTableDone(meta *reader.Meta, database string, tables []string) bool
- func (tableRecords *TableRecords) Set(value TableRecords)
- func (tableRecords *TableRecords) SetTableInfo(table string, tableInfo TableInfo)
Constants ¶
View Source
const ( SqlOffsetConnector = "##" SqlSpliter = ";" 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='SCHEMA_NAME';" DefaultMSSQLTable = "" /* 144-byte string literal not displayed */ SupportReminder = "magic only support @(YYYY) @(YY) @(MM) @(DD) @(hh) @(mm) @(ss)" Wildcards = "*" DefaultDoneRecordsFile = "sql.records" DefaultDoneSqlsFile = "sqls" TimestampRecordsFile = "timestamp.records" CacheMapFile = "cachemap.records" )
View Source
const ( // 获取符合条件的table TABLE = iota // 获取符合条件的database DATABASE // 获取数据库表的总条数 COUNT )
View Source
const ( // 获取数据条数的函数 COUNTFUNC = iota // 获取读取数据的函数 READFUNC )
View Source
const ( YEAR = iota MONTH DAY HOUR MINUTE SECOND )
Variables ¶
This section is empty.
Functions ¶
func CheckMagic ¶ added in v1.5.4
func CompareRemainStr ¶ added in v1.5.4
func CompareTime ¶ added in v1.5.4
查看时间是否符合, min为true则取出来为小于等于,min为false则取出来大于等于
func CompareWithStartTime ¶ added in v1.5.4
-1 代表不存在; 1 代表更大; 0 代表相等
func CompareWithStartTimeInt ¶ added in v1.5.4
-1 代表不存在; 1 代表更大; 0 代表相等
func CompareWithStartTimeStr ¶ added in v1.5.4
-1 代表不存在; 1 代表更大; 0 代表相等
func ConvertBool ¶ added in v1.5.4
func ConvertDate ¶ added in v1.5.4
func ConvertFloat ¶ added in v1.5.4
func ConvertLong ¶ added in v1.5.4
func ConvertMagicIndex ¶ added in v1.5.4
仅支持 YYYY, YY, MM, DD, hh, mm, ss,不支持 M, D, h, m, s
func ConvertScanArgs ¶ added in v1.5.4
func ConvertString ¶ added in v1.5.4
func ConvertUUID ¶ added in v1.5.5
func GetInitScans ¶ added in v1.5.4
func GetOffsetIndex ¶ added in v1.5.4
func GetOffsetIndexWithTimeStamp ¶ added in v1.5.4
func GetRemainStr ¶ added in v1.5.4
func GetTimeFromArgs ¶ added in v1.5.4
func GetTimeFromData ¶ added in v1.5.4
func GetTimeIntFromArgs ¶ added in v1.5.4
func GetTimeIntFromData ¶ added in v1.5.4
func GetTimeStrFromData ¶ added in v1.5.4
func QueryNumber ¶ added in v1.5.4
这个query只有一行
func RemoveWildcards ¶ added in v1.5.4
若包含通配符,字段长度相应 - 1
func RestoreMeta ¶ added in v1.5.4
func RestoreTimestampIntOffset ¶ added in v1.5.4
func RestoreTimestampOffset ¶ added in v1.5.4
func RestoreTimestampStrOffset ¶ added in v1.5.4
func SchemaCheck ¶ added in v1.5.4
func WriteCacheMap ¶ added in v1.5.4
func WriteRecordsFile ¶
WriteRecordsFile 将当前文件写入donefiel中
func WriteSqlsFile ¶ added in v1.5.4
WriteSqlsFile 将当前文件写入donefiel中
func WriteTimestampOffset ¶ added in v1.5.4
Types ¶
type DBRecords ¶
type DBRecords map[string]TableRecords
func (*DBRecords) GetTableRecords ¶
func (dbRecords *DBRecords) GetTableRecords(db string) TableRecords
func (*DBRecords) SetTableInfo ¶ added in v1.5.2
func (*DBRecords) SetTableRecords ¶
func (dbRecords *DBRecords) SetTableRecords(db string, tableRecords TableRecords)
type MagicRes ¶ added in v1.5.3
type ReadInfo ¶ added in v1.5.4
func SortByJson ¶ added in v1.5.4
if Marshal failed return all data
type SyncDBRecords ¶ added in v1.5.1
func (*SyncDBRecords) CheckDoneRecords ¶ added in v1.5.4
func (syncDBRecords *SyncDBRecords) CheckDoneRecords(target, curDB string) bool
func (*SyncDBRecords) GetDBRecords ¶ added in v1.5.1
func (syncDBRecords *SyncDBRecords) GetDBRecords() DBRecords
func (*SyncDBRecords) GetTableRecords ¶ added in v1.5.1
func (syncDBRecords *SyncDBRecords) GetTableRecords(db string) TableRecords
func (*SyncDBRecords) Reset ¶ added in v1.5.1
func (syncDBRecords *SyncDBRecords) Reset()
func (*SyncDBRecords) RestoreRecordsFile ¶ added in v1.5.4
func (dbRecords *SyncDBRecords) RestoreRecordsFile(meta *reader.Meta) (lastDB, lastTable string, omitDoneDBRecords bool)
func (*SyncDBRecords) SetTableInfo ¶ added in v1.5.2
func (syncDBRecords *SyncDBRecords) SetTableInfo(db, table string, tableInfo TableInfo)
func (*SyncDBRecords) SetTableRecords ¶ added in v1.5.1
func (syncDBRecords *SyncDBRecords) SetTableRecords(db string, tableRecords TableRecords)
type TableRecords ¶
func (*TableRecords) GetTable ¶ added in v1.5.2
func (tableRecords *TableRecords) GetTable() map[string]TableInfo
func (*TableRecords) GetTableInfo ¶
func (tableRecords *TableRecords) GetTableInfo(table string) TableInfo
func (*TableRecords) Reset ¶
func (tableRecords *TableRecords) Reset()
func (*TableRecords) RestoreTableDone ¶ added in v1.5.4
func (*TableRecords) Set ¶
func (tableRecords *TableRecords) Set(value TableRecords)
func (*TableRecords) SetTableInfo ¶
func (tableRecords *TableRecords) SetTableInfo(table string, tableInfo TableInfo)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.