m2o

package
v1.0.29 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

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.

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.

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.

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.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOracleConstraint

func GetOracleConstraint(schemaName, tableName string, oracle *oracle.Oracle) ([]public.ConstraintPUKey, []public.ConstraintForeign, []public.ConstraintCheck, error)

func GetOracleTableColumn

func GetOracleTableColumn(schemaName, tableName string, oracle *oracle.Oracle, sourceDBCharacterSet, nlsComp string,
	sourceTableCollation string, sourceSchemaCollation string, oraCollation bool) (map[string]public.Column, string, error)

func GetOracleTableIndex

func GetOracleTableIndex(schemaName, tableName string, oracle *oracle.Oracle) ([]public.Index, error)

func MySQLTableColumnMapRuleCheck

func MySQLTableColumnMapRuleCheck(
	sourceSchema, targetSchema, tableName, columnName string,
	oracleColInfo, mysqlColInfo public.Column) (string, table.Row, error)

func NewMySQLTableINFO

func NewMySQLTableINFO(schemaName, tableName, targetDBType string, mysql *mysql.MySQL) (*public.Table, string, error)

func NewOracleTableINFO

func NewOracleTableINFO(schemaName, tableName string, oracle *oracle.Oracle, sourceCharacterSet, nlsComp string,
	sourceTableCollation, sourceSchemaCollation string, oracleCollation bool) (*public.Table, error)

Types

type Check

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

func NewCheck

func NewCheck(ctx context.Context, cfg *config.Config) (*Check, error)

func (*Check) Check

func (r *Check) Check() error

type Diff

type Diff struct {
	Ctx                context.Context
	DBTypeS            string        `json:"db_type_s"`
	DBTypeT            string        `json:"db_type_t"`
	OracleTableINFO    *public.Table `json:"oracle_table_info"`
	MySQLTableINFO     *public.Table `json:"mysql_table_info"`
	MySQLDBVersion     string        `json:"mysqldb_version"`
	OracleDBVersion    string        `json:"oracle_db_version"`
	OracleDBExtendMode bool          `json:"oracle_db_extend_mode"`
	MetaDB             *meta.Meta    `json:"-"`
}

func NewChecker

func NewChecker(ctx context.Context, oracleTableInfo, mysqlTableInfo *public.Table, dbTypeS, dbTypeT, mysqlDBVersion, oracleDBVersion string, oracleDBExtendMode bool, metaDB *meta.Meta) *Diff

func (*Diff) CheckCheckKey

func (c *Diff) CheckCheckKey() (string, error)

func (*Diff) CheckColumn

func (c *Diff) CheckColumn() (string, error)

func (*Diff) CheckColumnCharacterSetAndCollation

func (c *Diff) CheckColumnCharacterSetAndCollation() string

func (*Diff) CheckColumnCounts

func (c *Diff) CheckColumnCounts() (string, error)

func (*Diff) CheckForeignKey

func (c *Diff) CheckForeignKey() (string, error)

func (*Diff) CheckIndex

func (c *Diff) CheckIndex() (string, error)

func (*Diff) CheckPartitionTable

func (c *Diff) CheckPartitionTable() (string, error)

func (*Diff) CheckPartitionTableType

func (c *Diff) CheckPartitionTableType() string

表结构对比 以上游表结构信息为基准,对比下游表结构 1、若上游存在,下游不存在,则输出记录,若上游不存在,下游存在,则默认不输出 2、忽略上下游不同索引名、约束名对比,只对比下游是否存在同等约束下同等字段是否存在 3、分区只对比分区类型、分区键、分区表达式等,不对比具体每个分区下的情况

func (*Diff) CheckPrimaryAndUniqueKey

func (c *Diff) CheckPrimaryAndUniqueKey() (string, error)

func (*Diff) CheckTableCharacterSetAndCollation

func (c *Diff) CheckTableCharacterSetAndCollation() string

func (*Diff) CheckTableComment

func (c *Diff) CheckTableComment() string

func (*Diff) String

func (c *Diff) String() string

func (*Diff) Writer

func (c *Diff) Writer(f *check.File) error

type Task

type Task struct {
	SourceSchemaName      string `json:"source_schema_name"`
	TargetSchemaName      string `json:"target_schema_name"`
	SourceTableName       string `json:"source_table_name"`
	TargetTableName       string `json:"target_table_name"`
	TargetDBCharacterSet  string `json:"target_db_character_set"`
	TargetDBNLSSort       string `json:"target_dbnls_sort"`
	TargetDBNLSComp       string `json:"target_dbnls_comp"`
	TargetDBCollation     bool   `json:"target_db_collation"`
	TargetTableCollation  string `json:"target_table_collation"`
	TargetSchemaCollation string `json:"target_schema_collation"`

	Oracle *oracle.Oracle `json:"-"`
	MySQL  *mysql.MySQL   `json:"-"`
}

func GenCheckTaskTable

func GenCheckTaskTable(sourceSchemaName, targetSchemaName, targetDBCharacterSet, nlsSort, nlsComp string,
	targetTableCollation map[string]string, targetSchemaCollation string,
	targetDBCollation bool, oracle *oracle.Oracle, mysql *mysql.MySQL, tableNameRule map[string]string, waitSyncMetas []meta.WaitSyncMeta) []*Task

func (*Task) GenMySQLTable

func (t *Task) GenMySQLTable() (*public.Table, string, error)

func (*Task) GenOracleTable

func (t *Task) GenOracleTable() (*public.Table, error)

func (*Task) String

func (t *Task) String() string

Jump to

Keyboard shortcuts

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