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 Query(db *sql.DB, querySQL string) ([]string, []map[string]string, error)
- type BaseModel
- type ColumnRuleMap
- type DataDiffMeta
- type DefaultValueMap
- type Engine
- func (e *Engine) AddOracleLogminerlogFile(logFile string) error
- func (e *Engine) AdjustTableSelectColumn(schemaName, tableName string, oraCollation bool) (string, error)
- func (e *Engine) BatchWriteMySQLTableData(targetSchemaName, targetTableName, sqlPrefix, querySQL string, ...) error
- func (e *Engine) ClearFullSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, rowidSQL string) error
- func (e *Engine) CloseOracleChunkTask(taskName string) error
- func (e *Engine) DeleteDataDiffMeta(schemaName, tableName, whereS string) error
- func (e *Engine) DeleteWaitSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, syncMode string) error
- func (e *Engine) EndOracleLogminerStoredProcedure() 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, reverseMode string) ([]ColumnRuleMap, error)
- func (e *Engine) GetDataDiffMeta(schemaName, tableName string) ([]DataDiffMeta, error)
- func (e *Engine) GetDefaultValueMap(reverseMode string) ([]DefaultValueMap, error)
- func (e *Engine) GetFinishFullSyncMetaRecord(schemaName string, syncMode string) ([]WaitSyncMeta, []string, error)
- func (e *Engine) GetFullSyncMetaRowIDRecord(schemaName, tableName string) ([]FullSyncMeta, error)
- func (e *Engine) GetMySQLDBServerCharacterSet() (string, error)
- func (e *Engine) GetMySQLDBServerCollation() (string, error)
- func (e *Engine) GetMySQLDBVersion() (string, error)
- func (e *Engine) GetMySQLDataRowStrings(querySQL string) ([]string, *strset.Set, uint32, error)
- func (e *Engine) GetMySQLNormalTable(schemaName string) ([]string, error)
- func (e *Engine) GetMySQLPartitionTable(schemaName string) ([]string, error)
- func (e *Engine) GetMySQLPartitionTableDetailINFO(schemaName, tableName string) (string, error)
- func (e *Engine) GetMySQLPartitionTableINFO(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLTable(schemaName string) ([]string, error)
- func (e *Engine) GetMySQLTableActualRows(mysqlQuery string) (int64, 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) (uint64, error)
- func (e *Engine) GetMySQLTableIncrementMetaRecord(sourceSchemaName string) ([]string, map[string]uint64, error)
- func (e *Engine) GetMySQLTableIndex(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLTableName(schemaName, tableName string) ([]string, error)
- func (e *Engine) GetMySQLTablePrimaryAndUniqueKey(schemaName, tableName string) ([]map[string]string, error)
- func (e *Engine) GetMySQLViewTable(schemaName 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) (uint64, 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() (uint64, uint64, string, error)
- func (e *Engine) GetOracleCurrentSnapshotSCN() (uint64, error)
- func (e *Engine) GetOracleDBCharacterNLSCompCollation() (string, error)
- func (e *Engine) GetOracleDBCharacterNLSSortCollation() (string, error)
- func (e *Engine) GetOracleDBCharacterSet() (string, error)
- func (e *Engine) GetOracleDBName() (string, string, string, error)
- func (e *Engine) GetOracleDBVersion() (string, error)
- func (e *Engine) GetOracleDataRowStrings(querySQL string) ([]string, *strset.Set, uint32, error)
- func (e *Engine) GetOracleDataTotal() (string, error)
- func (e *Engine) GetOracleExtendedMode() (bool, 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) GetOracleMaxActiveSessionCount() ([]map[string]string, 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) (uint64, error)
- func (e *Engine) GetOracleSchemaCollation(schemaName string) (string, 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) GetOracleTableActualRows(oraQuery string) (int64, error)
- func (e *Engine) GetOracleTableCheckKey(schemaName string, tableName string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableChunksByNUMBER(...) (int, error)
- func (e *Engine) GetOracleTableChunksByRowID(...) (int, error)
- func (e *Engine) GetOracleTableCollation(schemaName, schemaCollation string) (map[string]string, error)
- func (e *Engine) GetOracleTableColumn(schemaName string, tableName string, oraCollation bool) ([]map[string]string, error)
- func (e *Engine) GetOracleTableColumnCountsOver512(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableColumnDistinctValue(schemaName, tableName string, columnList []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) GetOracleTableRowLengthOver6M(schemaName []string) ([]map[string]string, error)
- func (e *Engine) GetOracleTableRowsData(querySQL string, insertBatchSize int) ([]string, []string, 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, reverseMode string) ([]SchemaRuleMap, error)
- func (e *Engine) GetTableErrorDetailCountByMode(schemaName, runMode string) (int64, error)
- func (e *Engine) GetTableErrorDetailCountBySources(schemaName, runMode, infoSources string) (int64, error)
- func (e *Engine) GetTableErrorDetailCountByTableMode(schemaName, tableName, runMode string) (int64, error)
- func (e *Engine) GetTableErrorDetailDistinctCountByMode(schemaName, runMode string) (int64, error)
- func (e *Engine) GetTableRuleMap(schemaName, tableName, reverseMode string) ([]TableRuleMap, error)
- func (e *Engine) GetTiDBAlterPKValue() (string, error)
- func (e *Engine) GetTiDBClusteredIndexValue() (string, error)
- func (e *Engine) GetWaitSyncTableMetaRecord(sourceSchema, syncMode string) ([]WaitSyncMeta, []string, error)
- func (e *Engine) InitDataDiffMetaRecordByNUMBER(...) error
- func (e *Engine) InitDataDiffMetaRecordByWhere(...) error
- func (e *Engine) InitDefaultValueMap() error
- func (e *Engine) InitIncrementSyncMetaRecord(schemaName, tableName, isPartition string, globalSCN uint64) error
- func (e *Engine) InitMysqlEngineDB() error
- func (e *Engine) InitWaitAndFullSyncMetaRecord(sourceSchema, sourceTable, sourceColumnInfo, targetSchema, targetTable string, ...) 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) 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) 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) IsNumberColumnTYPE(schemaName, tableName, indexFiledName string) (bool, error)
- func (e *Engine) IsOraclePartitionTable(schemaName, tableName string) (bool, error)
- func (e *Engine) JudgingCheckpointResume(schemaName string, tableMetas []WaitSyncMeta, syncMode string) ([]string, error)
- func (e *Engine) ModifyWaitAndFullSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, rowidSQL, syncMode string) error
- func (e *Engine) ModifyWaitSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, syncMode string) error
- func (e *Engine) RenameMySQLTableName(schemaName string, tableName string) error
- func (e *Engine) StartOracleChunkCreateTask(taskName string) error
- func (e *Engine) StartOracleCreateChunkByNUMBER(taskName, schemaName, tableName, numberColName string, chunkSize string) error
- func (e *Engine) StartOracleCreateChunkByRowID(taskName, schemaName, tableName string, chunkSize string) error
- func (e *Engine) StartOracleLogminerStoredProcedure(scn string) error
- func (e *Engine) TruncateDataDiffMetaRecord(metaSchemaName 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 uint64, transferTableSlice []string) error
- func (e *Engine) UpdateSingleTableIncrementMetaSCNByCurrentRedo(sourceSchemaName string, ...) error
- func (e *Engine) UpdateSingleTableIncrementMetaSCNByNonCurrentRedo(sourceSchemaName string, ...) error
- func (e *Engine) UpdateTableIncrementMetaALLSCNRecord(sourceSchemaName, sourceTableName, operationType string, ...) error
- func (e *Engine) UpdateWaitSyncMetaTableRecord(schemaName, tableName string, rowCounts int, globalSCN uint64, ...) error
- type FullSyncMeta
- type IncrementSyncMeta
- type LogminerContent
- type SchemaRuleMap
- type TableErrorDetail
- type TableRuleMap
- type WaitSyncMeta
Constants ¶
This section is empty.
Variables ¶
var ( // Oracle/Mysql 对于 'NULL' 统一字符 NULL 处理,查询出来转成 NULL,所以需要判断处理 // 查询字段值 NULL // 如果字段值 = NULLABLE 则表示值是 NULL // 如果字段值 = "" 则表示值是空字符串 // 如果字段值 = 'NULL' 则表示值是 NULL 字符串 // 如果字段值 = 'null' 则表示值是 null 字符串 IsNull = "NULLABLE" )
Functions ¶
Types ¶
type BaseModel ¶ added in v1.0.5
type BaseModel struct {
CreatedAt string `gorm:"type:timestamp;not null;comment:'创建时间'" json:"createdAt"`
UpdatedAt string `gorm:"type:timestamp;not null;comment:'更新时间'" json:"updatedAt"`
}
func (*BaseModel) BeforeCreate ¶ added in v1.0.5
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_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"`
SourceColumnName string `gorm:"not null;index:unique_schema_table_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"`
ReverseMode string `gorm:"not null;index:idx_reverse_mode;comment:'表结构转换模式 O2M/M2O'" json:"reverse_mode"`
BaseModel
}
上下游字段类型映射表
数据类型转换优先级: column > table > schema > build-in 自定义列转换规则 - 字段列级别
func (*ColumnRuleMap) AdjustColumnDataType ¶ added in v1.0.4
func (c *ColumnRuleMap) AdjustColumnDataType(tableName, columnName string) string
type DataDiffMeta ¶ added in v1.0.5
type DataDiffMeta struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceSchemaName string `gorm:"not null;index:idx_schema_table_range;comment:'源端 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:idx_schema_table_range;comment:'源端表名'" json:"source_table_name"`
SourceColumnInfo string `gorm:"type:text;comment:'源端查询字段信息'" json:"source_column_info"`
TargetColumnInfo string `gorm:"type:text;comment:'目标端查询字段信息'" json:"target_column_info"`
Range string `gorm:"not null;index:idx_schema_table_range;comment:'查询 where 条件'" json:"range"`
NumberColumn string `gorm:"comment:'number 类型字段列'" json:"number_column"` // 值为空则是指定 WHERE 对比或者 WHERE 1=1 对比
IsPartition string `gorm:"comment:'是否是分区表'" json:"is_partition"` // 同步转换统一转换成非分区表,此处只做标志
BaseModel
}
数据校验元数据表
func (*DataDiffMeta) GetDataDiffMetaTableName ¶ added in v1.0.5
func (df *DataDiffMeta) GetDataDiffMetaTableName(schemaName string, engine *Engine) ([]string, error)
func (*DataDiffMeta) String ¶ added in v1.0.5
func (df *DataDiffMeta) 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"`
ReverseMode string `gorm:"not null;index:idx_reverse_mode;comment:'表结构转换模式 O2M/M2O'" json:"reverse_mode"`
BaseModel
}
自定义字段默认值转换规则 - global 级别
type Engine ¶
定义数据库引擎
func (*Engine) AddOracleLogminerlogFile ¶
func (*Engine) AdjustTableSelectColumn ¶ added in v1.0.5
func (*Engine) BatchWriteMySQLTableData ¶ added in v1.0.4
func (e *Engine) BatchWriteMySQLTableData(targetSchemaName, targetTableName, sqlPrefix, querySQL string, valuesBatchArgs []string, applyThreads int) error
Preapre 批量 Batch
func (*Engine) ClearFullSyncTableMetaRecord ¶ added in v1.0.5
func (e *Engine) ClearFullSyncTableMetaRecord(metaSchemaName, sourceSchemaName, sourceTableName, rowidSQL string) error
清理并更新同步任务元数据表 1、全量每成功同步一张表记录,再清理记录 2、更新同步数据表元信息
func (*Engine) CloseOracleChunkTask ¶ added in v1.0.4
func (*Engine) DeleteDataDiffMeta ¶ added in v1.0.5
func (*Engine) DeleteWaitSyncTableMetaRecord ¶ added in v1.0.4
func (*Engine) EndOracleLogminerStoredProcedure ¶
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, reverseMode string) ([]ColumnRuleMap, error)
func (*Engine) GetDataDiffMeta ¶ added in v1.0.5
func (e *Engine) GetDataDiffMeta(schemaName, tableName string) ([]DataDiffMeta, error)
func (*Engine) GetDefaultValueMap ¶ added in v1.0.4
func (e *Engine) GetDefaultValueMap(reverseMode string) ([]DefaultValueMap, error)
func (*Engine) GetFinishFullSyncMetaRecord ¶ added in v1.0.4
func (*Engine) GetFullSyncMetaRowIDRecord ¶ added in v1.0.4
func (e *Engine) GetFullSyncMetaRowIDRecord(schemaName, tableName string) ([]FullSyncMeta, error)
func (*Engine) GetMySQLDBServerCharacterSet ¶
MySQL
func (*Engine) GetMySQLDBServerCollation ¶
func (*Engine) GetMySQLDBVersion ¶
func (*Engine) GetMySQLDataRowStrings ¶ added in v1.0.5
func (*Engine) GetMySQLNormalTable ¶ added in v1.0.5
func (*Engine) GetMySQLPartitionTable ¶ added in v1.0.5
func (*Engine) GetMySQLPartitionTableDetailINFO ¶ added in v1.0.5
func (*Engine) GetMySQLPartitionTableINFO ¶
func (*Engine) GetMySQLTable ¶ added in v1.0.5
func (*Engine) GetMySQLTableActualRows ¶ added in v1.0.5
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) GetMySQLTableName ¶ added in v1.0.5
func (*Engine) GetMySQLTablePrimaryAndUniqueKey ¶
func (*Engine) GetMySQLViewTable ¶ added in v1.0.5
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) GetOracleDBCharacterNLSCompCollation ¶ added in v1.0.5
func (*Engine) GetOracleDBCharacterNLSSortCollation ¶ added in v1.0.5
func (*Engine) GetOracleDBCharacterSet ¶
func (*Engine) GetOracleDBVersion ¶ added in v1.0.5
Oracle
func (*Engine) GetOracleDataRowStrings ¶ added in v1.0.5
获取数据行 -> 用于 DIFF
func (*Engine) GetOracleDataTotal ¶
func (*Engine) GetOracleExtendedMode ¶ added in v1.0.5
func (*Engine) GetOracleGlobalName ¶
func (*Engine) GetOracleIndexType ¶
func (*Engine) GetOracleInstance ¶
func (*Engine) GetOracleLogminerContentToMySQL ¶
func (*Engine) GetOracleMaxActiveSessionCount ¶ added in v1.0.5
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) GetOracleRedoLogSCN ¶
func (*Engine) GetOracleSchemaCollation ¶ added in v1.0.5
func (*Engine) GetOracleSchemaOverview ¶
func (*Engine) GetOracleSchemaTableRowsTOP ¶
func (*Engine) GetOracleSynonymObjectType ¶
func (*Engine) GetOracleTable ¶
func (*Engine) GetOracleTableActualRows ¶ added in v1.0.5
func (*Engine) GetOracleTableCheckKey ¶
func (*Engine) GetOracleTableChunksByNUMBER ¶ added in v1.0.5
func (*Engine) GetOracleTableChunksByRowID ¶ added in v1.0.4
func (*Engine) GetOracleTableCollation ¶ added in v1.0.5
func (*Engine) GetOracleTableColumn ¶
func (*Engine) GetOracleTableColumnCountsOver512 ¶
func (*Engine) GetOracleTableColumnDistinctValue ¶ added in v1.0.5
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) GetOracleTableRowLengthOver6M ¶
func (*Engine) GetOracleTableRowsData ¶ added in v1.0.5
func (e *Engine) GetOracleTableRowsData(querySQL string, insertBatchSize int) ([]string, []string, error)
获取表字段名以及行数据 -> 用于 FULL/ALL
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, reverseMode string) ([]SchemaRuleMap, error)
func (*Engine) GetTableErrorDetailCountByMode ¶ added in v1.0.5
func (*Engine) GetTableErrorDetailCountBySources ¶ added in v1.0.5
func (*Engine) GetTableErrorDetailCountByTableMode ¶ added in v1.0.5
func (*Engine) GetTableErrorDetailDistinctCountByMode ¶ added in v1.0.5
func (*Engine) GetTableRuleMap ¶ added in v1.0.4
func (e *Engine) GetTableRuleMap(schemaName, tableName, reverseMode string) ([]TableRuleMap, error)
func (*Engine) GetTiDBAlterPKValue ¶ added in v1.0.5
func (*Engine) GetTiDBClusteredIndexValue ¶ added in v1.0.5
func (*Engine) GetWaitSyncTableMetaRecord ¶ added in v1.0.4
func (e *Engine) GetWaitSyncTableMetaRecord(sourceSchema, syncMode string) ([]WaitSyncMeta, []string, error)
func (*Engine) InitDataDiffMetaRecordByNUMBER ¶ added in v1.0.5
func (*Engine) InitDataDiffMetaRecordByWhere ¶ added in v1.0.5
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) IsExistMySQLTableCharacterSetAndCollation ¶
func (*Engine) IsExistMysqlIndex ¶
func (*Engine) IsExistOracleSchema ¶
func (*Engine) IsExistWaitSyncTableMetaRecord ¶ added in v1.0.4
func (*Engine) IsFinishFullSyncMetaRecord ¶ added in v1.0.4
func (*Engine) IsMySQLPartitionTable ¶
func (*Engine) IsNumberColumnTYPE ¶ added in v1.0.5
func (*Engine) IsOraclePartitionTable ¶
func (*Engine) JudgingCheckpointResume ¶ added in v1.0.4
func (e *Engine) JudgingCheckpointResume(schemaName string, tableMetas []WaitSyncMeta, syncMode string) ([]string, error)
该函数只应用于全量同步模式或者 ALL 同步模式 1、断点续传判断,判断是否可进行断点续传 2、判断是否存在未初始化元信息的表
func (*Engine) ModifyWaitAndFullSyncTableMetaRecord ¶ added in v1.0.4
func (*Engine) ModifyWaitSyncTableMetaRecord ¶ added in v1.0.5
func (*Engine) RenameMySQLTableName ¶
func (*Engine) StartOracleChunkCreateTask ¶ added in v1.0.4
func (*Engine) StartOracleCreateChunkByNUMBER ¶ added in v1.0.5
func (*Engine) StartOracleCreateChunkByRowID ¶ added in v1.0.4
func (*Engine) StartOracleLogminerStoredProcedure ¶
func (*Engine) TruncateDataDiffMetaRecord ¶ added in v1.0.5
func (*Engine) TruncateFullSyncTableMetaRecord ¶ added in v1.0.4
清理全量同步任务元数据表
func (*Engine) TruncateMySQLTableRecord ¶
func (*Engine) UpdateSingleTableIncrementMetaSCNByArchivedLog ¶
func (*Engine) UpdateSingleTableIncrementMetaSCNByCurrentRedo ¶
func (*Engine) UpdateSingleTableIncrementMetaSCNByNonCurrentRedo ¶
func (*Engine) UpdateTableIncrementMetaALLSCNRecord ¶
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 uint64 `gorm:"comment:'全局 SCN'" json:"global_scn"`
SourceSQL string `gorm:"type:text;comment:'源端 sql'" json:"source_sql"`
RowidSQL string `gorm:"type:varchar(300);not null;index:idx_schema_table_rowid;comment:'表 rowid 切分SQL'" json:"rowid_sql"`
IsPartition string `gorm:"comment:'是否是分区表'" json:"is_partition"` // 同步转换统一转换成非分区表,此处只做标志
CSVFile string `gorm:"type:varchar(300);comment:'csv 文件名'" json:"csv_file"`
BaseModel
}
全量同步元数据表
func (*FullSyncMeta) GetFullSyncMetaTableName ¶ added in v1.0.5
func (f *FullSyncMeta) GetFullSyncMetaTableName(schemaName string, engine *Engine) ([]string, error)
type IncrementSyncMeta ¶ added in v1.0.4
type IncrementSyncMeta struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
GlobalSCN uint64 `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 uint64 `gorm:"comment:'表同步 SCN'" json:"source_table_scn"`
IsPartition string `gorm:"comment:'是否是分区表'" json:"is_partition"` // 同步转换统一转换成非分区表,此处只做标志
BaseModel
}
增量同步元数据表
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 uint64
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"`
ReverseMode string `gorm:"not null;index:idx_reverse_mode;comment:'表结构转换模式 O2M/M2O'" json:"reverse_mode"`
BaseModel
}
自定义库转换规则 - schema 级别
func (*SchemaRuleMap) AdjustSchemaDataType ¶ added in v1.0.4
func (c *SchemaRuleMap) AdjustSchemaDataType() string
type TableErrorDetail ¶ added in v1.0.5
type TableErrorDetail struct {
ID uint `gorm:"primary_key;autoIncrement;comment:'自增编号'" json:"id"`
SourceSchemaName string `gorm:"not null;index:idx_schema_table_mode;comment:'源端 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:idx_schema_table_mode;comment:'源端表名'" json:"source_table_name"`
RunMode string `gorm:"not null;index:idx_schema_table_mode;comment:'运行模式'" json:"run_mode"`
InfoSources string `gorm:"not null;comment:'信息来源'" json:"info_sources"`
RunStatus string `gorm:"not null;comment:'运行状态'" json:"run_status"`
Detail string `gorm:"not null;comment:'信息详情'" json:"detail"`
Error string `gorm:"not null;comment:'错误详情'" json:"error"`
BaseModel
}
表错误详情 用于 reverse 和 check 模式
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"`
ReverseMode string `gorm:"not null;index:idx_reverse_mode;comment:'表结构转换模式 O2M/M2O'" json:"reverse_mode"`
BaseModel
}
自定义表转换规则 - table 级别
func (*TableRuleMap) AdjustTableDataType ¶ added in v1.0.4
func (c *TableRuleMap) AdjustTableDataType(tableName string) string
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_mode,unique;comment:'源端 schema'" json:"source_schema_name"`
SourceTableName string `gorm:"not null;index:idx_schema_table_mode,unique;comment:'源端表名'" json:"source_table_name"`
SyncMode string `gorm:"not null;index:idx_schema_table_mode,unique;comment:'同步模式'" json:"sync_mode"`
FullGlobalSCN uint64 `gorm:"comment:'全量全局 SCN'" json:"full_global_scn"`
FullSplitTimes int `gorm:"comment:'全量任务切分 SQL 次数'" json:"full_split_times"`
IsPartition string `gorm:"comment:'是否是分区表'" json:"is_partition"` // 同步转换统一转换成非分区表,此处只做标志
BaseModel
}
同步元数据表