check

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 16 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.

Index

Constants

View Source
const (
	OracleGBKCharacterSet  = "GBK"
	OracleUTF8CharacterSet = "UTF8"
	// oracle collation 默认大小写敏感,a != A
	OracleCollationBin = "BIN"
	// MySQL 支持 check 约束版本 > 8.0.15
	MySQLCheckConsVersion = "8.0.15"
	// MySQL 版本分隔符号
	MySQLVersionDelimiter = "-"
	// MySQL 字符集/排序规则
	MySQLCharacterSet = "utf8mb4"
	MySQLCollation    = "utf8mb4_bin"

	// JSON 格式化某字段
	ColumnsJSON      = "column"
	IndexJSON        = "index"
	PUConstraintJSON = "puk"
	FKConstraintJSON = "fk"
	CKConstraintJSON = "ck"
	PartitionJSON    = "partition"
)

Variables

This section is empty.

Functions

func OracleTableMapRuleCheck

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

func OracleTableToMySQLMappingCheck

func OracleTableToMySQLMappingCheck(engine *service.Engine, cfg *service.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
	Engine           *service.Engine
	*FileMW
}

func NewDiffWriter

func NewDiffWriter(sourceSchemaName, targetSchemaName, tableName string, engine *service.Engine, fileMW *FileMW) *DiffWriter

func (*DiffWriter) DiffOracleAndMySQLTable

func (d *DiffWriter) DiffOracleAndMySQLTable() error

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

type FileMW

type FileMW struct {
	Mutex  sync.Mutex
	Writer io.Writer
}

func (*FileMW) Write

func (d *FileMW) Write(b []byte) (n int, err error)

type Index

type Index struct {
	IndexInfo
	IndexType     string
	ColumnExpress string
}

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 string, engine *service.Engine) (*Table, string, error)

func NewOracleTableINFO

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

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