Documentation
¶
Overview ¶
Copyright © 2020 Marvin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func GetAppVersion(version bool)
- func NewZapLogger(cfg *CfgFile) (err error)
- func Query(db *sql.DB, querySQL string) ([]string, []map[string]string, error)
- func RecordAppVersion(app string, logger *zap.Logger, cfg *CfgFile)
- type AllConfig
- type AppConfig
- type CfgFile
- type ColumnRuleMap
- type DefaultValueMap
- type Engine
- func (e *Engine) AddOracleLogminerlogFile(logFile string) error
- func (e *Engine) BatchWriteMySQLTableData(targetSchemaName, targetTableName, insertPrepareSql string, ...) error
- func (e *Engine) CloseOracleChunkTask(taskName string) error
- func (e *Engine) DeleteWaitSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, syncMode string) error
- func (e *Engine) EndOracleLogminerStoredProcedure() error
- func (e *Engine) FilterDifferenceOracleTable(schemaName string, excludeTables []string) ([]string, error)
- func (e *Engine) FilterIntersectionMySQLTable(schemaName string, includeTables []string) ([]string, error)
- func (e *Engine) FilterOracleClusteredTable(schemaName string, tableSlice []string) ([]string, error)
- func (e *Engine) FilterOraclePartitionTable(schemaName string, tableSlice []string) ([]string, error)
- func (e *Engine) FilterOracleTemporaryTable(schemaName string, tableSlice []string) ([]string, error)
- func (e *Engine) GetColumnRuleMap(schemaName, tableName string) ([]ColumnRuleMap, error)
- func (e *Engine) GetDefaultValueMap() ([]DefaultValueMap, error)
- func (e *Engine) GetFinishFullSyncMetaRecord(schemaName string, syncMode string) ([]WaitSyncMeta, []string, error)
- func (e *Engine) GetFullSyncMetaRowIDRecord(schemaName, tableName string) ([]string, error)
- func (e *Engine) GetMySQLDBServerCharacterSet() (string, error)
- func (e *Engine) GetMySQLDBServerCollation() (string, error)
- func (e *Engine) GetMySQLDBVersion() (string, error)
- func (e *Engine) GetMySQLPartitionTableINFO(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLTableCharacterSetAndCollation(schemaName, tableName string) (string, string, error)
- func (e *Engine) GetMySQLTableCheckKey(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLTableColumn(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLTableComment(schemaName, tableName string) (string, error)
- func (e *Engine) GetMySQLTableForeignKey(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLTableIncrementMetaMinGlobalSCNTime(sourceSchemaName string) (int, error)
- func (e *Engine) GetMySQLTableIncrementMetaMinSourceTableSCNTime(sourceSchemaName string) (int, error)
- func (e *Engine) GetMySQLTableIncrementMetaRecord(sourceSchemaName string) ([]string, map[string]int, error)
- func (e *Engine) GetMySQLTableIndex(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLTablePrimaryAndUniqueKey(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleALLRedoLogFile() ([]string, error)
- func (e *Engine) GetOracleArchivedLogFile(scn string) ([]map[string]string, error)
- func (e *Engine) GetOracleArchivedLogSCN(scn string) (int, error)
- func (e *Engine) GetOracleAvgRowLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleCodeObject(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleColumnTypeAndMaxLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleConstraintType(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleCurrentRedoMaxSCN() (int, int, string, error)
- func (e *Engine) GetOracleCurrentSnapshotSCN() (int, error)
- func (e *Engine) GetOracleDBCharacterSet() (string, error)
- func (e *Engine) GetOracleDBName() (string, string, string, error)
- func (e *Engine) GetOracleDataTotal() (string, error)
- func (e *Engine) GetOracleGlobalName() (string, error)
- func (e *Engine) GetOracleIndexType(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleInstance() ([]map[string]string, error)
- func (e *Engine) GetOracleLogminerContentToMySQL(schemaName string, sourceTableNameList string, lastCheckpoint string, ...) ([]LogminerContent, error)
- func (e *Engine) GetOracleMemoryGB() (string, error)
- func (e *Engine) GetOracleNumCPU() (string, error)
- func (e *Engine) GetOracleObjectTypeOverview(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleParameters() (string, string, string, string, error)
- func (e *Engine) GetOraclePartitionObjectType(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOraclePartitionTableINFO(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOraclePartitionTableOver1024(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleRedoLogFile(scn string) ([]map[string]string, error)
- func (e *Engine) GetOracleRedoLogSCN(scn string) (int, error)
- func (e *Engine) GetOracleSchemaOverview(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleSchemaTableRowsTOP(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleSynonymObjectType(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTable(schemaName string) ([]string, error)
- func (e *Engine) GetOracleTableCheckKey(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableChunksByRowID(taskName, schemaName, tableName string, globalSCN, insertBatchSize int, ...) (int, error)
- func (e *Engine) GetOracleTableColumn(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableColumnCountsOver512(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableColumnNameLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableComment(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableForeignKey(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableIndexCountsOver64(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableIndexLengthOver3072(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableIndexNameLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableNameLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableNormalIndex(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableNumberTypeCheck(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTablePrimaryKey(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableRecordByRowIDSQL(sql string) ([]string, []interface{}, error)
- func (e *Engine) GetOracleTableRowLengthOver6M(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableRows(querySQL string) ([]string, []interface{}, error)
- func (e *Engine) GetOracleTableSequenceNameLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableType(schemaName string) (map[string]string, error)
- func (e *Engine) GetOracleTableUniqueIndex(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableUniqueKey(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableViewNameLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTemporaryTable(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleUsernameLength(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetPartSyncTableMetaRecord(sourceSchema, syncMode string) ([]WaitSyncMeta, []string, error)
- func (e *Engine) GetSchemaRuleMap(schemaName string) ([]SchemaRuleMap, error)
- func (e *Engine) GetTableRuleMap(schemaName, tableName string) ([]TableRuleMap, error)
- func (e *Engine) GetWaitSyncTableMetaRecord(sourceSchema, syncMode string) ([]WaitSyncMeta, []string, error)
- func (e *Engine) InitDefaultValueMap() error
- func (e *Engine) InitIncrementSyncMetaRecord(schemaName, tableName, isPartition string, globalSCN int) error
- func (e *Engine) InitMysqlEngineDB() error
- func (e *Engine) InitWaitAndFullSyncMetaRecord(schemaName, tableName string, workerID, globalSCN int, ...) error
- func (e *Engine) InitWaitSyncTableMetaRecord(schemaName string, tableName []string, syncMode string) error
- func (e *Engine) IsExistIncrementSyncMetaRecord(schemaName string, transferTableSlice []string) ([]string, []string, error)
- func (e *Engine) IsExistMySQLSchema(schemaName string) (bool, error)
- func (e *Engine) IsExistMySQLTable(schemaName, tableName string) (bool, error)
- func (e *Engine) IsExistMySQLTableCharacterSetAndCollation(schemaName, tableName string) (bool, error)
- func (e *Engine) IsExistMysqlIndex(schemaName, tableName, indexName string) bool
- func (e *Engine) IsExistOracleSchema(schemaName string) error
- func (e *Engine) IsExistOracleTable(schemaName string, includeTables []string) error
- func (e *Engine) IsExistWaitSyncTableMetaRecord(schemaName string, tableName, syncMode string) (bool, error)
- func (e *Engine) IsFinishFullSyncMetaRecord(schemaName string, transferTableSlice []string, syncMode string) ([]string, error)
- func (e *Engine) IsMySQLPartitionTable(schemaName, tableName string) (bool, error)
- func (e *Engine) IsOraclePartitionTable(schemaName, tableName string) (bool, error)
- func (e *Engine) JudgingCheckpointResume(schemaName string, tableMetas []WaitSyncMeta) ([]string, error)
- func (e *Engine) ModifyWaitAndFullSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, rowidSQL, syncMode string) error
- func (e *Engine) RenameMySQLTableName(schemaName string, tableName string) error
- func (e *Engine) StartOracleChunkCreateTask(taskName string) error
- func (e *Engine) StartOracleCreateChunkByRowID(taskName, schemaName, tableName string, chunkSize string) error
- func (e *Engine) StartOracleLogminerStoredProcedure(scn string) error
- func (e *Engine) TruncateFullSyncTableMetaRecord(metaSchemaName string) error
- func (e *Engine) TruncateMySQLTableRecord(targetSchemaName string, tableName string) error
- func (e *Engine) UpdateSingleTableIncrementMetaSCNByArchivedLog(sourceSchemaName string, logFileEndSCN int, transferTableSlice []string) error
- func (e *Engine) UpdateSingleTableIncrementMetaSCNByCurrentRedo(sourceSchemaName string, lastRedoLogMaxSCN, logFileStartSCN, logFileEndSCN int) error
- func (e *Engine) UpdateSingleTableIncrementMetaSCNByNonCurrentRedo(sourceSchemaName string, lastRedoLogMaxSCN, logFileStartSCN, logFileEndSCN int, ...) error
- func (e *Engine) UpdateTableIncrementMetaALLSCNRecord(sourceSchemaName, sourceTableName, operationType string, ...) error
- func (e *Engine) UpdateWaitSyncMetaTableRecord(schemaName, tableName string, rowCounts, globalSCN int, ...) error
- type FullConfig
- type FullSyncMeta
- type GormLogger
- func (l GormLogger) Error(ctx context.Context, str string, args ...interface{})
- func (l GormLogger) Info(ctx context.Context, str string, args ...interface{})
- func (l GormLogger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
- func (l GormLogger) SetAsDefault()
- func (l GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l GormLogger) Warn(ctx context.Context, str string, args ...interface{})
- type IncrementSyncMeta
- type LogConfig
- type LogminerContent
- type SchemaRuleMap
- type SourceConfig
- type TableRuleMap
- type TargetConfig
- type WaitSyncMeta
Constants ¶
This section is empty.
Variables ¶
var ( Version = "None" BuildTS = "None" GitHash = "None" GitBranch = "None" )
版本信息
var ( // Oracle/Mysql 对于 'NULL' 统一字符 NULL 处理,查询出来转成 NULL,所以需要判断处理 // 查询字段值 NULL // 如果字段值 = NULLABLE 则表示值是 NULL // 如果字段值 = "" 则表示值是空字符串 // 如果字段值 = 'NULL' 则表示值是 NULL 字符串 // 如果字段值 = 'null' 则表示值是 null 字符串 IsNull = "NULLABLE" )
var Logger *zap.Logger
Functions ¶
func GetAppVersion ¶
func GetAppVersion(version bool)
Types ¶
type AllConfig ¶
type AllConfig struct {
LogminerQueryTimeout int `toml:"logminer-query-timeout" json:"logminer-query-timeout"`
FilterThreads int `toml:"filter-threads" json:"filter-threads"`
ApplyThreads int `toml:"apply-threads" json:"apply-threads"`
WorkerQueue int `toml:"worker-queue" json:"worker-queue"`
WorkerThreads int `toml:"worker-threads" json:"worker-threads"`
}
type CfgFile ¶
type CfgFile struct {
AppConfig AppConfig `toml:"app" json:"app"`
FullConfig FullConfig `toml:"full" json:"full"`
AllConfig AllConfig `toml:"all" json:"all"`
SourceConfig SourceConfig `toml:"source" json:"source"`
TargetConfig TargetConfig `toml:"target" json:"target"`
LogConfig LogConfig `toml:"log" json:"log"`
}
程序配置文件
func (*CfgFile) GenerateTables ¶
根据配置文件获取表列表
type ColumnRuleMap ¶ added in v1.0.4
type ColumnRuleMap struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceSchemaName string `gorm:"not null;index:unique_schema_col,unique;comment:'源端库 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:unique_schema_col,unique;comment:'源端表名'" json:"source_table_name"`
SourceColumnName string `gorm:"not null;index:unique_schema_col,unique;comment:'源端表字段列名'" json:"source_column_name"`
SourceColumnType string `gorm:"not null;index:idx_source_col;comment:'源端表字段类型'" json:"source_column_type"`
TargetColumnType string `gorm:"not null;index:idx_source_col;comment:'目标表字段类型'" json:"target_column_type"`
CreatedAt *time.Time `gorm:"type:timestamp;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
UpdatedAt *time.Time `gorm:"type:timestamp;not null on update current_timestamp;default:current_timestamp;comment:'更新时间'" json:"updatedAt"`
}
上下游字段类型映射表
数据类型转换优先级: column > table > schema > build-in 自定义列转换规则 - 字段列级别
func (*ColumnRuleMap) AdjustColumnDataType ¶ added in v1.0.4
func (c *ColumnRuleMap) AdjustColumnDataType(tableName, columnName string) string
type DefaultValueMap ¶ added in v1.0.4
type DefaultValueMap struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceDefaultValue string `gorm:"not null;index:unique_source_default,unique;comment:'源端默认值'" json:"source_default_value"`
TargetDefaultValue string `gorm:"not null;index:idx_target_default;comment:'目标默认值'" json:"target_default_value"`
CreatedAt *time.Time `gorm:"type:timestamp;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
UpdatedAt *time.Time `gorm:"type:timestamp;not null on update current_timestamp;default:current_timestamp;comment:'更新时间'" json:"updatedAt"`
}
自定义字段默认值转换规则 - global 级别
type Engine ¶
定义数据库引擎
func (*Engine) AddOracleLogminerlogFile ¶
func (*Engine) BatchWriteMySQLTableData ¶ added in v1.0.4
func (e *Engine) BatchWriteMySQLTableData(targetSchemaName, targetTableName, insertPrepareSql string, args [][]interface{}, applyThreads int) error
批量 Batch
func (*Engine) CloseOracleChunkTask ¶ added in v1.0.4
func (*Engine) DeleteWaitSyncTableMetaRecord ¶ added in v1.0.4
func (*Engine) EndOracleLogminerStoredProcedure ¶
func (*Engine) FilterDifferenceOracleTable ¶
func (*Engine) FilterIntersectionMySQLTable ¶
func (*Engine) FilterOracleClusteredTable ¶ added in v1.0.4
func (*Engine) FilterOraclePartitionTable ¶
func (*Engine) FilterOracleTemporaryTable ¶ added in v1.0.4
func (*Engine) GetColumnRuleMap ¶ added in v1.0.4
func (e *Engine) GetColumnRuleMap(schemaName, tableName string) ([]ColumnRuleMap, error)
func (*Engine) GetDefaultValueMap ¶ added in v1.0.4
func (e *Engine) GetDefaultValueMap() ([]DefaultValueMap, error)
func (*Engine) GetFinishFullSyncMetaRecord ¶ added in v1.0.4
func (*Engine) GetFullSyncMetaRowIDRecord ¶ added in v1.0.4
func (*Engine) GetMySQLDBServerCharacterSet ¶
MySQL
func (*Engine) GetMySQLDBServerCollation ¶
func (*Engine) GetMySQLDBVersion ¶
func (*Engine) GetMySQLPartitionTableINFO ¶
func (*Engine) GetMySQLTableCharacterSetAndCollation ¶
func (*Engine) GetMySQLTableCheckKey ¶
func (*Engine) GetMySQLTableColumn ¶
func (*Engine) GetMySQLTableComment ¶
func (*Engine) GetMySQLTableForeignKey ¶
func (*Engine) GetMySQLTableIncrementMetaMinGlobalSCNTime ¶
func (*Engine) GetMySQLTableIncrementMetaMinSourceTableSCNTime ¶
func (*Engine) GetMySQLTableIncrementMetaRecord ¶
func (*Engine) GetMySQLTableIndex ¶
func (*Engine) GetMySQLTablePrimaryAndUniqueKey ¶
func (*Engine) GetOracleALLRedoLogFile ¶
func (*Engine) GetOracleArchivedLogFile ¶
func (*Engine) GetOracleArchivedLogSCN ¶
func (*Engine) GetOracleAvgRowLength ¶
func (*Engine) GetOracleCodeObject ¶
func (*Engine) GetOracleColumnTypeAndMaxLength ¶
func (*Engine) GetOracleConstraintType ¶
func (*Engine) GetOracleCurrentRedoMaxSCN ¶
func (*Engine) GetOracleCurrentSnapshotSCN ¶
func (*Engine) GetOracleDBCharacterSet ¶
Oracle
func (*Engine) GetOracleDataTotal ¶
func (*Engine) GetOracleGlobalName ¶
func (*Engine) GetOracleIndexType ¶
func (*Engine) GetOracleInstance ¶
func (*Engine) GetOracleLogminerContentToMySQL ¶
func (*Engine) GetOracleMemoryGB ¶
func (*Engine) GetOracleNumCPU ¶
func (*Engine) GetOracleObjectTypeOverview ¶
func (*Engine) GetOracleParameters ¶
func (*Engine) GetOraclePartitionObjectType ¶
func (*Engine) GetOraclePartitionTableINFO ¶
func (*Engine) GetOraclePartitionTableOver1024 ¶
func (*Engine) GetOracleRedoLogFile ¶
func (*Engine) GetOracleSchemaOverview ¶
func (*Engine) GetOracleSchemaTableRowsTOP ¶
func (*Engine) GetOracleSynonymObjectType ¶
func (*Engine) GetOracleTable ¶
func (*Engine) GetOracleTableCheckKey ¶
func (*Engine) GetOracleTableChunksByRowID ¶ added in v1.0.4
func (*Engine) GetOracleTableColumn ¶
func (*Engine) GetOracleTableColumnCountsOver512 ¶
func (*Engine) GetOracleTableColumnNameLength ¶
func (*Engine) GetOracleTableComment ¶
func (*Engine) GetOracleTableForeignKey ¶
func (*Engine) GetOracleTableIndexCountsOver64 ¶
func (*Engine) GetOracleTableIndexLengthOver3072 ¶
func (*Engine) GetOracleTableIndexNameLength ¶
func (*Engine) GetOracleTableNameLength ¶
func (*Engine) GetOracleTableNormalIndex ¶ added in v1.0.4
func (*Engine) GetOracleTableNumberTypeCheck ¶
func (*Engine) GetOracleTablePrimaryKey ¶
func (*Engine) GetOracleTableRecordByRowIDSQL ¶
func (*Engine) GetOracleTableRowLengthOver6M ¶
func (*Engine) GetOracleTableRows ¶ added in v1.0.4
获取表字段名以及行数据
func (*Engine) GetOracleTableSequenceNameLength ¶
func (*Engine) GetOracleTableType ¶ added in v1.0.4
func (*Engine) GetOracleTableUniqueIndex ¶ added in v1.0.4
func (*Engine) GetOracleTableUniqueKey ¶
func (*Engine) GetOracleTableViewNameLength ¶
func (*Engine) GetOracleTemporaryTable ¶
func (*Engine) GetOracleUsernameLength ¶
func (*Engine) GetPartSyncTableMetaRecord ¶ added in v1.0.4
func (e *Engine) GetPartSyncTableMetaRecord(sourceSchema, syncMode string) ([]WaitSyncMeta, []string, error)
获取全量待同步表信息
func (*Engine) GetSchemaRuleMap ¶ added in v1.0.4
func (e *Engine) GetSchemaRuleMap(schemaName string) ([]SchemaRuleMap, error)
func (*Engine) GetTableRuleMap ¶ added in v1.0.4
func (e *Engine) GetTableRuleMap(schemaName, tableName string) ([]TableRuleMap, error)
func (*Engine) GetWaitSyncTableMetaRecord ¶ added in v1.0.4
func (e *Engine) GetWaitSyncTableMetaRecord(sourceSchema, syncMode string) ([]WaitSyncMeta, []string, error)
func (*Engine) InitDefaultValueMap ¶ added in v1.0.4
func (*Engine) InitIncrementSyncMetaRecord ¶ added in v1.0.4
func (*Engine) InitWaitAndFullSyncMetaRecord ¶ added in v1.0.4
func (*Engine) InitWaitSyncTableMetaRecord ¶ added in v1.0.4
func (*Engine) IsExistIncrementSyncMetaRecord ¶ added in v1.0.4
func (*Engine) IsExistMySQLSchema ¶
func (*Engine) IsExistMySQLTable ¶
func (*Engine) IsExistMySQLTableCharacterSetAndCollation ¶
func (*Engine) IsExistMysqlIndex ¶
func (*Engine) IsExistOracleSchema ¶
func (*Engine) IsExistOracleTable ¶
func (*Engine) IsExistWaitSyncTableMetaRecord ¶ added in v1.0.4
func (*Engine) IsFinishFullSyncMetaRecord ¶ added in v1.0.4
func (*Engine) IsMySQLPartitionTable ¶
func (*Engine) IsOraclePartitionTable ¶
func (*Engine) JudgingCheckpointResume ¶ added in v1.0.4
func (e *Engine) JudgingCheckpointResume(schemaName string, tableMetas []WaitSyncMeta) ([]string, error)
该函数只应用于全量同步模式或者 ALL 同步模式 1、断点续传判断,判断是否可进行断点续传 2、判断是否存在未初始化元信息的表
func (*Engine) ModifyWaitAndFullSyncTableMetaRecord ¶ added in v1.0.4
func (e *Engine) ModifyWaitAndFullSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, rowidSQL, syncMode string) error
清理并更新同步任务元数据表 1、全量每成功同步一张表记录,再清理记录 2、更新同步数据表元信息
func (*Engine) RenameMySQLTableName ¶
func (*Engine) StartOracleChunkCreateTask ¶ added in v1.0.4
func (*Engine) StartOracleCreateChunkByRowID ¶ added in v1.0.4
func (*Engine) StartOracleLogminerStoredProcedure ¶
func (*Engine) TruncateFullSyncTableMetaRecord ¶ added in v1.0.4
清理全量同步任务元数据表
func (*Engine) TruncateMySQLTableRecord ¶
func (*Engine) UpdateSingleTableIncrementMetaSCNByArchivedLog ¶
func (*Engine) UpdateSingleTableIncrementMetaSCNByCurrentRedo ¶
func (*Engine) UpdateSingleTableIncrementMetaSCNByNonCurrentRedo ¶
func (*Engine) UpdateTableIncrementMetaALLSCNRecord ¶
type FullConfig ¶
type FullConfig struct {
ChunkSize int `toml:"chunk-size" json:"chunk-size"`
WorkerThreads int `toml:"worker-threads" json:"worker-threads"`
TableThreads int `toml:"table-threads" json:"table-threads"`
EnableCheckpoint bool `toml:"enable-checkpoint" json:"enable-checkpoint"`
ApplyThreads int `toml:"apply-threads" json:"apply-threads"`
}
type FullSyncMeta ¶ added in v1.0.4
type FullSyncMeta struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceSchemaName string `gorm:"not null;index:idx_schema_table_rowid;comment:'源端 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:idx_schema_table_rowid;comment:'源端表名'" json:"source_table_name"`
GlobalSCN int `gorm:"comment:'全局 SCN'" json:"global_scn"`
RowidSQL string `gorm:"not null;index:idx_schema_table_rowid;comment:'表 rowid 切分SQL'" json:"rowid_sql"`
IsPartition string `gorm:"comment:'是否是分区表'" json:"is_partition"` // 同步转换统一转换成非分区表,此处只做标志
CreatedAt *time.Time `gorm:"type:timestamp;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
UpdatedAt *time.Time `gorm:"type:timestamp;not null on update current_timestamp;default:current_timestamp;comment:'更新时间'" json:"updatedAt"`
}
全量同步元数据表
func (*FullSyncMeta) GetFullSyncMetaRecordCounts ¶ added in v1.0.4
func (f *FullSyncMeta) GetFullSyncMetaRecordCounts(schemaName, tableName string, engine *Engine) (int, error)
type GormLogger ¶
type GormLogger struct {
ZapLogger *zap.Logger
LogLevel gormLogger.LogLevel
SlowThreshold time.Duration
SkipCallerLookup bool
Colorful bool
}
func NewGormLogger ¶
func NewGormLogger(zapLogger *zap.Logger, slowThreshold time.Duration) GormLogger
func (GormLogger) Error ¶
func (l GormLogger) Error(ctx context.Context, str string, args ...interface{})
func (GormLogger) Info ¶
func (l GormLogger) Info(ctx context.Context, str string, args ...interface{})
func (GormLogger) LogMode ¶
func (l GormLogger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
func (GormLogger) SetAsDefault ¶
func (l GormLogger) SetAsDefault()
type IncrementSyncMeta ¶ added in v1.0.4
type IncrementSyncMeta struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
GlobalSCN int `gorm:"comment:'全局 SCN'" json:"global_scn"`
SourceSchemaName string `gorm:"not null;index:unique_schema_table,unique;comment:'源端 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:unique_schema_table,unique;comment:'源端表名'" json:"source_table_name"`
SourceTableSCN int `gorm:"comment:'表同步 SCN'" json:"source_table_scn"`
IsPartition string `gorm:"comment:'是否是分区表'" json:"is_partition"` // 同步转换统一转换成非分区表,此处只做标志
CreatedAt *time.Time `gorm:"type:timestamp;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
UpdatedAt *time.Time `gorm:"type:timestamp;not null on update current_timestamp;default:current_timestamp;comment:'更新时间'" json:"updatedAt"`
}
增量同步元数据表
func (*IncrementSyncMeta) GetIncrementSyncMetaRecordCounts ¶ added in v1.0.4
func (f *IncrementSyncMeta) GetIncrementSyncMetaRecordCounts(schemaName, tableName string, engine *Engine) (int, error)
type LogminerContent ¶
type LogminerContent struct {
SCN int
SegOwner string
TableName string
SQLRedo string
SQLUndo string
Operation string
}
获取 Oracle logminer 日志内容并过滤筛选已提交的 INSERT/DELETE/UPDATE 事务语句 考虑异构数据库,只同步 INSERT/DELETE/UPDATE 事务语句以及 TRUNCATE TABLE/DROP TABLE DDL 语句,其他类型 SQL 不同步 V$LOGMNR_CONTENTS 字段解释参考链接 https://docs.oracle.com/en/database/oracle/oracle-database/21/refrn/V-LOGMNR_CONTENTS.html#GUID-B9196942-07BF-4935-B603-FA875064F5C3
type SchemaRuleMap ¶ added in v1.0.4
type SchemaRuleMap struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceSchemaName string `gorm:"not null;index:unique_schema_col,unique;comment:'源端库 schema'" json:"source_schema_name"`
SourceColumnType string `gorm:"not null;index:unique_schema_col,unique;comment:'源端表字段类型'" json:"source_column_type"`
TargetColumnType string `gorm:"not null;index:idx_target_col;comment:'目标表字段类型'" json:"target_column_type"`
CreatedAt *time.Time `gorm:"type:timestamp;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
UpdatedAt *time.Time `gorm:"type:timestamp;not null on update current_timestamp;default:current_timestamp;comment:'更新时间'" json:"updatedAt"`
}
自定义库转换规则 - schema 级别
func (*SchemaRuleMap) AdjustSchemaDataType ¶ added in v1.0.4
func (c *SchemaRuleMap) AdjustSchemaDataType() string
type SourceConfig ¶
type SourceConfig struct {
Username string `toml:"username" json:"username"`
Password string `toml:"password" json:"password"`
ConnectString string `toml:"connect-string",json:"connect-string"`
SessionParams []string `toml:"session-params" json:"session-params"`
Timezone string `toml:"timezone" json:"timezone"`
SchemaName string `toml:"schema-name",json:"schema-name"`
IncludeTable []string `toml:"include-table",json:"include-table"`
ExcludeTable []string `toml:"exclude-table",json:"exclude-table"`
}
type TableRuleMap ¶ added in v1.0.4
type TableRuleMap struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceSchemaName string `gorm:"not null;index:unique_schema_table_col,unique;comment:'源端库 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:unique_schema_table_col,unique;comment:'源端表名'" json:"source_table_name"`
SourceColumnType string `gorm:"not null;index:unique_schema_table_col,unique;comment:'源端表字段类型'" json:"source_column_type"`
TargetColumnType string `gorm:"not null;index:idx_target_col;comment:'目标表字段类型'" json:"target_column_type"`
CreatedAt *time.Time `gorm:"type:timestamp;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
UpdatedAt *time.Time `gorm:"type:timestamp;not null on update current_timestamp;default:current_timestamp;comment:'更新时间'" json:"updatedAt"`
}
自定义表转换规则 - table 级别
func (*TableRuleMap) AdjustTableDataType ¶ added in v1.0.4
func (c *TableRuleMap) AdjustTableDataType(tableName string) string
type TargetConfig ¶
type TargetConfig struct {
Username string `toml:"username" json:"username"`
Password string `toml:"password" json:"password"`
Host string `toml:"host" json:"host"`
Port int `toml:"port" json:"port"`
ConnectParams string `toml:"connect-params" json:"connect-params"`
MetaSchema string `toml:"meta-schema" json:"meta-schema"`
SchemaName string `toml:"schema-name",json:"schema-name"`
Overwrite bool `toml:"overwrite" json:"overwrite"`
}
type WaitSyncMeta ¶ added in v1.0.4
type WaitSyncMeta struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceSchemaName string `gorm:"not null;index:idx_schema_table,unique;comment:'源端 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:idx_schema_table,unique;comment:'源端表名'" json:"source_table_name"`
SyncMode string `gorm:"not null;index:idx_sync_mode;comment:'同步模式'" json:"sync_mode"`
FullGlobalSCN int `gorm:"comment:'全量全局 SCN'" json:"full_global_scn"`
FullSplitTimes int `gorm:"comment:'全量任务切分 SQL 次数'" json:"full_split_times"`
IsPartition string `gorm:"comment:'是否是分区表'" json:"is_partition"` // 同步转换统一转换成非分区表,此处只做标志
CreatedAt *time.Time `gorm:"type:timestamp;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
UpdatedAt *time.Time `gorm:"type:timestamp;not null on update current_timestamp;default:current_timestamp;comment:'更新时间'" json:"updatedAt"`
}
同步元数据表