check

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: Apache-2.0 Imports: 18 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOracleConstraint added in v1.0.5

func GetOracleConstraint(schemaName, tableName string, engine *service.Engine) ([]ConstraintPUKey, []ConstraintForeign, []ConstraintCheck, error)

func GetOracleTableColumn added in v1.0.5

func GetOracleTableColumn(schemaName, tableName string, engine *service.Engine, sourceDBCharacterSet, nlsComp string,
	sourceTableCollation string, sourceSchemaCollation string, oraCollation bool) (map[string]Column, string, error)

func OracleTableColumnMapRuleReverse added in v1.0.5

func OracleTableColumnMapRuleReverse(
	sourceSchema, sourceTableName, columnName string,
	dataType, dataNullable, comments, dataDefault string,
	dataScaleValue, dataPrecisionValue, dataLengthValue, columnCharacter, columnCollation string, engine *service.Engine) (string, error)

Oracle 表字段映射转换 -> Check 阶段

func OracleTableMapRuleCheck

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

Oracle 表规则映射检查

func OracleTableToMySQLMappingCheck

func OracleTableToMySQLMappingCheck(engine *service.Engine, cfg *config.CfgFile) error

Types

type Column

type Column struct {
	DataType                string
	CharLength              string
	CharUsed                string
	CharacterSet            string
	Collation               string
	OracleOriginDataDefault string
	MySQLOriginDataDefault  string
	ColumnInfo
}

type ColumnInfo

type ColumnInfo struct {
	DataLength        string
	DataPrecision     string
	DataScale         string
	DatetimePrecision string
	NULLABLE          string
	DataDefault       string
	Comment           string
}

type ConstraintCheck

type ConstraintCheck struct {
	ConstraintExpression string
}

type ConstraintForeign

type ConstraintForeign struct {
	ColumnName            string
	ReferencedTableSchema string
	ReferencedTableName   string
	ReferencedColumnName  string
	DeleteRule            string
	UpdateRule            string
}

type ConstraintPUKey

type ConstraintPUKey struct {
	ConstraintType   string
	ConstraintColumn string
}

type DiffWriter

type DiffWriter struct {
	SourceSchemaName      string
	TargetSchemaName      string
	TableName             string
	SourceDBCharacterSet  string
	SourceDBNLSSort       string
	SourceDBNLSComp       string
	SourceDBCollation     bool
	SourceTableCollation  string
	SourceSchemaCollation string
	Engine                *service.Engine `json:"-"`
	Cfg                   *config.CfgFile `json:"-"`
	ChkFileMW             *o2m.FileMW     `json:"-"`
}

func NewDiffWriter

func NewDiffWriter(sourceSchemaName, targetSchemaName, tableName,
	sourceCharacterSet, nlsSort, nlsComp string,
	sourceTableCollation map[string]string,
	sourceSchemaCollation string,
	oracleCollation bool,
	engine *service.Engine, cfg *config.CfgFile, chkFileMW *o2m.FileMW) *DiffWriter

func (*DiffWriter) DiffTable added in v1.0.5

func (d *DiffWriter) DiffTable() error

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

func (*DiffWriter) String added in v1.0.5

func (d *DiffWriter) String() string

type Index

type Index struct {
	IndexInfo
	IndexName        string
	IndexType        string
	DomainIndexOwner string
	DomainIndexName  string
	DomainParameters string
}

func GetOracleTableIndex added in v1.0.5

func GetOracleTableIndex(schemaName, tableName string, engine *service.Engine) ([]Index, error)

type IndexInfo

type IndexInfo struct {
	Uniqueness  string
	IndexColumn string
}

type Partition

type Partition struct {
	PartitionKey     string
	PartitionType    string
	SubPartitionKey  string
	SubPartitionType string
}

type Table

type Table struct {
	SchemaName         string
	TableName          string
	TableComment       string
	TableCharacterSet  string
	TableCollation     string
	Columns            map[string]Column // KEY 字段名
	Indexes            []Index
	PUConstraints      []ConstraintPUKey
	ForeignConstraints []ConstraintForeign
	CheckConstraints   []ConstraintCheck
	IsPartition        bool
	Partitions         []Partition // 获取分区键、分区类型以及子分区键、子分区类型
}

func NewMySQLTableINFO

func NewMySQLTableINFO(schemaName, tableName, targetDBType string, engine *service.Engine) (*Table, string, error)

MySQL

func NewOracleTableINFO

func NewOracleTableINFO(schemaName, tableName string, engine *service.Engine, sourceCharacterSet, nlsComp string,
	sourceTableCollation, sourceSchemaCollation string, oracleCollation bool) (*Table, error)

Oracle

func (*Table) String

func (t *Table) String(jsonType string) string

Jump to

Keyboard shortcuts

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