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.
Index ¶
- func IDataCompareProcess(p IDataCompareProcessor) error
- func IDataMigrateProcess(p IDataMigrateProcessor) error
- func IStructCompareProcessor(p IDatabaseStructCompareProcessor) (*structure.Table, error)
- func IStructCompareTable(dsct IDatabaseStructCompareTable) (string, error)
- type DataCompareAttributesRule
- type DataMigrateAttributesRule
- type IDataCompareProcessor
- type IDataCompareRuleInitializer
- type IDataMigrateProcessor
- type IDataMigrateRuleInitializer
- type IDatabase
- type IDatabaseAssessMigrate
- type IDatabaseDataCompare
- type IDatabaseDataMigrate
- type IDatabaseObjectFilter
- type IDatabaseSchemaTableRule
- type IDatabaseSequenceMigrate
- type IDatabaseStructCompare
- type IDatabaseStructCompareProcessor
- type IDatabaseStructCompareTable
- type IDatabaseStructMigrate
- type IFileWriter
- type ISequenceMigrateDatabaseWriter
- type ISqlMigrateRuleInitializer
- type IStructMigrateAttributesProcessor
- type IStructMigrateAttributesReader
- type IStructMigrateAttributesRuleReader
- type IStructMigrateDatabaseWriter
- type IStructMigrateFileWriter
- type SqlMigrateAttributesRule
- type StructMigrateAttributes
- type StructMigrateAttributesRule
- type TableStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IDataCompareProcess ¶
func IDataCompareProcess(p IDataCompareProcessor) error
func IDataMigrateProcess ¶
func IDataMigrateProcess(p IDataMigrateProcessor) error
func IStructCompareProcessor ¶
func IStructCompareProcessor(p IDatabaseStructCompareProcessor) (*structure.Table, error)
func IStructCompareTable ¶
func IStructCompareTable(dsct IDatabaseStructCompareTable) (string, error)
Types ¶
type DataCompareAttributesRule ¶
type DataCompareAttributesRule struct {
SchemaNameS string `json:"schemaNameS"`
SchemaNameT string `json:"schemaNameT"`
TableNameS string `json:"tableNameS"`
TableTypeS string `json:"tableTypeS"`
TableNameT string `json:"tableNameT"`
ColumnDetailSO string `json:"columnDetailSO"`
ColumnDetailS string `json:"columnDetailS"`
ColumnDetailT string `json:"columnDetailT"`
ColumnDetailTO string `json:"columnDetailTO"`
CompareMethod string `json:"compareMethod"`
ColumnFieldC string `json:"columnFieldC"`
CompareRangeC string `json:"compareRangeC"`
}
func IDataCompareAttributesRule ¶
func IDataCompareAttributesRule(i IDataCompareRuleInitializer) (*DataCompareAttributesRule, error)
type DataMigrateAttributesRule ¶
type DataMigrateAttributesRule struct {
SchemaNameS string `json:"schemaNameS"`
SchemaNameT string `json:"schemaNameT"`
TableNameS string `json:"tableNameS"`
TableTypeS string `json:"tableTypeS"`
TableNameT string `json:"tableNameT"`
ColumnDetailO string `json:"columnDetailO"`
ColumnDetailS string `json:"columnDetailS"`
ColumnDetailT string `json:"columnDetailT"`
EnableChunkStrategy bool `json:"enableChunkStrategy"`
SqlHintS string `json:"sqlHintS"`
WhereRange string `json:"whereRange"`
}
func IDataMigrateAttributesRule ¶
func IDataMigrateAttributesRule(i IDataMigrateRuleInitializer) (*DataMigrateAttributesRule, error)
type IDataCompareProcessor ¶
type IDataCompareRuleInitializer ¶
type IDataCompareRuleInitializer interface {
GenSchemaTableCompareMethodRule() string
GenSchemaTableCustomRule() (string, string, error)
IDatabaseSchemaTableRule
}
IDataCompareRuleInitializer used for database table rule initializer
type IDataMigrateProcessor ¶
type IDataMigrateRuleInitializer ¶
type IDataMigrateRuleInitializer interface {
GenSchemaTableCustomRule() (bool, string, string, error)
IDatabaseSchemaTableRule
}
IDataMigrateRuleInitializer used for database table rule initializer
type IDatabase ¶
type IDatabase interface {
PrepareContext(ctx context.Context, sqlStr string) (*sql.Stmt, error)
QueryContext(ctx context.Context, sqlStr string, args ...any) (*sql.Rows, error)
ExecContext(ctx context.Context, sqlStr string, args ...any) (sql.Result, error)
GeneralQuery(sqlStr string) ([]string, []map[string]string, error)
PingDatabaseConnection() error
Close() error
IDatabaseObjectFilter
IDatabaseAssessMigrate
IDatabaseStructMigrate
IDatabaseSequenceMigrate
IDatabaseDataMigrate
IDatabaseDataCompare
IDatabaseStructCompare
}
func NewDatabase ¶
func NewDatabase(ctx context.Context, datasource *datasource.Datasource, migrateOracleSchema string) (IDatabase, error)
type IDatabaseAssessMigrate ¶
type IDatabaseAssessMigrate interface {
GetDatabaseSoftVersion() (string, error)
GetDatabasePlatformName() (string, string, string, error)
GetDatabaseGlobalName() (string, error)
GetDatabaseParameters() (string, string, string, string, error)
GeDatabaseInstance() ([]map[string]string, error)
GetDatabaseSize() (string, error)
GetDatabaseSchemaNameALL() ([]string, error)
GetDatabaseSchemaNameSingle(schemaNameS string) (string, error)
GetDatabaseServerNumCPU() (string, error)
GetDatabaseServerMemorySize() (string, error)
GetDatabaseSessionMaxActiveCount() ([]map[string]string, error)
GetDatabaseSchemaTableIndexOverview(schemaNameS []string) ([]map[string]string, error)
GetDatabaseSchemaTableRowsTOP(schemaName []string, top int) ([]map[string]string, error)
GetDatabaseSchemaCodeObject(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaPartitionTableType(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaTableAvgRowLengthTOP(schemaName []string, top int) ([]map[string]string, error)
GetDatabaseSchemaSynonymObject(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaMaterializedViewObject(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaPartitionTableCountsOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableAvgRowLengthOverLimitMB(schemaName []string, limitMB int) ([]map[string]string, error)
GetDatabaseSchemaTableIndexLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableColumnCountsOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableIndexCountsOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseUsernameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableColumnNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableIndexNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableViewNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableSequenceNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
GetDatabaseSchemaTableTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaColumnDataDefaultCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaViewTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaObjectTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaPartitionTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaSubPartitionTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaTemporaryTableTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaConstraintTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaIndexTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaColumnTypeCounts(schemaName []string) ([]map[string]string, error)
GetDatabaseSchemaTableSpecialDatatype(schemaName []string, specialDatatype string) ([]map[string]string, error)
}
IDatabaseAssessMigrate used for database assess migrate
type IDatabaseDataCompare ¶
type IDatabaseDataCompare interface {
FindDatabaseTableBestColumn(schemaNameS, tableNameS, columnNameS string) ([]string, error)
GetDatabaseTableColumnAttribute(schemaNameS, tableNameS, columnNameS string, collationS bool) ([]map[string]string, error)
GetDatabaseTableColumnBucket(schemaNameS, tableNameS string, columnNameS, datatypeS string) ([]string, error)
GetDatabaseTableCompareData(querySQL string, callTimeout int, dbCharsetS, dbCharsetT string) ([]string, uint32, map[string]int64, error)
}
type IDatabaseDataMigrate ¶
type IDatabaseDataMigrate interface {
GetDatabaseRole() (string, error)
GetDatabaseVersion() (string, error)
GetDatabaseCharset() (string, error)
GetDatabaseConsistentPos() (uint64, error)
GetDatabaseTableType(schemaName string) (map[string]string, error)
GetDatabaseTableColumnInfo(schemaName string, tableName string, collation bool) ([]map[string]string, error)
GetDatabaseTableColumnNameTableDimensions(schemaName, tableName string) ([]string, error)
GetDatabaseTableColumnNameSqlDimensions(sqlStr string) ([]string, map[string]string, map[string]string, error)
GetDatabaseTableRows(schemaName, tableName string) (uint64, error)
GetDatabaseTableSize(schemaName, tableName string) (float64, error)
GetDatabaseTableChunkTask(taskName, schemaName, tableName string, chunkSize uint64, callTimeout uint64) ([]map[string]string, error)
GetDatabaseTableChunkData(querySQL string, batchSize, callTimeout int, dbCharsetS, dbCharsetT, columnDetailO string, dataChan chan []interface{}) error
GetDatabaseTableCsvData(querySQL string, callTimeout int, taskFlow, dbCharsetS, dbCharsetT, columnDetailO string, escapeBackslash bool, nullValue, separator, delimiter string, dataChan chan []string) error
}
IDatabaseDataMigrate used for database table data migrate
type IDatabaseObjectFilter ¶
type IDatabaseStructCompare ¶
type IDatabaseStructCompare interface {
GetDatabaseTablePartitionExpress(schemaName string, tableName string) ([]map[string]string, error)
}
IDatabaseStructCompare used for database table struct migrate
type IDatabaseStructCompareProcessor ¶
type IDatabaseStructCompareProcessor interface {
GenDatabaseSchemaTable() (string, string)
GenDatabaseTableCollation() (string, error)
GenDatabaseTableCharset() (string, error)
GenDatabaseTableComment() (string, error)
GenDatabaseTableColumnDetail() (map[string]structure.NewColumn, map[string]map[string]structure.OldColumn, error)
GenDatabaseTableIndexDetail() (map[string]structure.Index, error)
GenDatabaseTablePrimaryConstraintDetail() (map[string]structure.ConstraintPrimary, error)
GenDatabaseTableUniqueConstraintDetail() (map[string]structure.ConstraintUnique, error)
GenDatabaseTableForeignConstraintDetail() (map[string]structure.ConstraintForeign, error)
GenDatabaseTableCheckConstraintDetail() (map[string]structure.ConstraintCheck, error)
GenDatabaseTablePartitionDetail() ([]structure.Partition, error)
}
type IDatabaseStructCompareTable ¶
type IDatabaseStructCompareTable interface {
ComparePartitionTableType() string
CompareTableComment() string
CompareTableCharsetCollation() string
CompareTableColumnCharsetCollation() string
CompareTableColumnCounts() string
CompareTablePrimaryConstraint() (string, error)
CompareTableUniqueConstraint() (string, error)
CompareTableForeignConstraint() (string, error)
CompareTableCheckConstraint() (string, error)
CompareTableIndexDetail() (string, error)
CompareTableColumnDetail() (string, error)
CompareTablePartitionDetail() (string, error)
}
type IDatabaseStructMigrate ¶
type IDatabaseStructMigrate interface {
GetDatabaseSchema() ([]string, error)
GetDatabaseTable(schemaName string) ([]string, error)
GetDatabaseCharset() (string, error)
GetDatabaseCollation() (string, error)
GetDatabaseVersion() (string, error)
GetDatabasePartitionTable(schemaName string) ([]string, error)
GetDatabaseTemporaryTable(schemaName string) ([]string, error)
GetDatabaseClusteredTable(schemaName string) ([]string, error)
GetDatabaseMaterializedView(schemaName string) ([]string, error)
GetDatabaseTableType(schemaName string) (map[string]string, error)
GetDatabaseTableColumnInfo(schemaName string, tableName string, collation bool) ([]map[string]string, error)
GetDatabaseTablePrimaryKey(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableUniqueKey(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableForeignKey(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableCheckKey(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableNormalIndex(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableUniqueIndex(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableComment(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableColumnComment(schemaName string, tableName string) ([]map[string]string, error)
GetDatabaseTableCharset(schemaName string, tableName string) (string, error)
GetDatabaseTableCollation(schemaName, tableName string) (string, error)
GetDatabaseSchemaCollation(schemaName string) (string, error)
GetDatabaseTableOriginStruct(schemaName, tableName, tableType string) (string, error)
}
IDatabaseStructMigrate used for database table struct migrate
type IFileWriter ¶
type ISqlMigrateRuleInitializer ¶
type ISqlMigrateRuleInitializer interface {
GenSqlMigrateSchemaNameRule() (string, error)
GenSqlMigrateTableNameRule() (string, error)
GenSqlMigrateTableColumnRule() (string, string, string, error)
GenSqlMigrateTableCustomRule() (string, string)
}
ISqlMigrateRuleInitializer used for database table rule initializer
type IStructMigrateAttributesProcessor ¶
type IStructMigrateAttributesProcessor interface {
GenSchemaNameS() string
GenTableNameS() string
GenTableTypeS() string
GenTableOriginDDlS() string
GenSchemaNameT() (string, error)
GenTableNameT() (string, error)
GenTableCreatePrefixT() string
GenTableSuffix() (string, error)
GenTablePrimaryKey() (string, error)
GenTableUniqueKey() ([]string, error)
GenTableForeignKey() ([]string, error)
GenTableCheckKey() ([]string, error)
GenTableUniqueIndex() ([]string, []string, error)
GenTableNormalIndex() ([]string, []string, error)
GenTableComment() (string, error)
GenTableColumns() ([]string, error)
GenTableColumnComment() ([]string, error)
}
type IStructMigrateAttributesReader ¶
type IStructMigrateAttributesReader interface {
GetTablePrimaryKey() ([]map[string]string, error)
GetTableUniqueKey() ([]map[string]string, error)
GetTableForeignKey() ([]map[string]string, error)
GetTableCheckKey() ([]map[string]string, error)
GetTableUniqueIndex() ([]map[string]string, error)
GetTableNormalIndex() ([]map[string]string, error)
GetTableComment() ([]map[string]string, error)
GetTableColumns() ([]map[string]string, error)
GetTableColumnComment() ([]map[string]string, error)
GetTableCharsetCollation() (string, string, error)
GetTableOriginStruct() (string, error)
}
IStructMigrateAttributesReader used for database table attributes
type IStructMigrateAttributesRuleReader ¶
type IStructMigrateAttributesRuleReader interface {
GetCreatePrefixRule() string
GetCaseFieldRule() string
GetSchemaNameRule() (map[string]string, error)
GetTableNameRule() (map[string]string, error)
GetTableColumnRule() (map[string]string, map[string]string, map[string]string, error)
GetTableAttributesRule() (string, error)
GetTableCommentRule() (string, error)
GetTableColumnCollationRule() (map[string]string, error)
GetTableColumnCommentRule() (map[string]string, error)
}
type SqlMigrateAttributesRule ¶
type SqlMigrateAttributesRule struct {
SchemaNameT string `json:"schemaNameT"`
TableNameT string `json:"tableNameT"`
ColumnDetailO string `json:"columnDetailO"`
ColumnDetailS string `json:"columnDetailS"`
ColumnDetailT string `json:"columnDetailT"`
SqlHintT string `json:"sqlHintS"`
SqlQueryS string `json:"sqlQueryS"`
}
func ISqlMigrateAttributesRule ¶
func ISqlMigrateAttributesRule(i ISqlMigrateRuleInitializer) (*SqlMigrateAttributesRule, error)
type StructMigrateAttributes ¶
type StructMigrateAttributes struct {
TableCharset string `json:"tableCharset"`
TableCollation string `json:"tableCollation"`
PrimaryKey []map[string]string `json:"primaryKey"`
UniqueKey []map[string]string `json:"uniqueKey"`
ForeignKey []map[string]string `json:"foreignKey"`
CheckKey []map[string]string `json:"checkKey"`
UniqueIndex []map[string]string `json:"uniqueIndex"`
NormalIndex []map[string]string `json:"normalIndex"`
TableComment []map[string]string `json:"tableComment"`
TableColumns []map[string]string `json:"tableColumns"`
ColumnComment []map[string]string `json:"columnComment"`
OriginStruct string `json:"originStruct"`
}
func IStructMigrateAttributes ¶
func IStructMigrateAttributes(t IStructMigrateAttributesReader) (*StructMigrateAttributes, error)
type StructMigrateAttributesRule ¶
type StructMigrateAttributesRule struct {
CreatePrefixRule string `json:"createPrefixRule"`
CaseFieldRuleT string `json:"caseFieldRule"`
SchemaNameRule map[string]string `json:"schemaNameRule"`
TableNameRule map[string]string `json:"tableNameRule"`
ColumnNameRule map[string]string `json:"columnNameRule"`
ColumnDatatypeRule map[string]string `json:"columnDatatypeRule"`
ColumnDefaultValueRule map[string]string `json:"columnDefaultValueRule"`
ColumnCollationRule map[string]string `json:"columnCollationRule"`
ColumnCommentRule map[string]string `json:"columnCommentRule"`
TableAttrRule string `json:"tableAttrRule"`
TableCommentRule string `json:"tableCommentRule"`
}
func IStructMigrateAttributesRule ¶
func IStructMigrateAttributesRule(t IStructMigrateAttributesRuleReader) (*StructMigrateAttributesRule, error)
type TableStruct ¶
type TableStruct struct {
SchemaNameS string `json:"schemaNameS"`
TableNameS string `json:"tableNameS"`
TableTypeS string `json:"tableTypeS"`
OriginDdlS string `json:"originDdlS"`
SchemaNameT string `json:"schemaNameT"`
TableNameT string `json:"tableNameT"`
TableCreatePrefixT string `json:"tableCreatePrefixT"`
TablePrimaryKey string `json:"tablePrimaryKey"`
TableColumns []string `json:"tableColumns"`
TableUniqueKeys []string `json:"tableUniqueKeys"`
TableNormalIndexes []string `json:"tableNormalIndexes"`
TableUniqueIndexes []string `json:"tableUniqueIndexes"`
TableSuffix string `json:"tableSuffix"`
TableComment string `json:"tableComment"`
TableColumnComment []string `json:"tableColumnComment"`
TableCheckKeys []string `json:"tableCheckKeys"`
TableForeignKeys []string `json:"tableForeignKeys"`
TableIncompatibleDDL []string `json:"tableIncompatibleDDL"`
}
func IStructMigrateTableStructure ¶
func IStructMigrateTableStructure(p IStructMigrateAttributesProcessor) (*TableStruct, error)