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.
Index ¶
- func GenCompatibilityTable(f *reverse.File, sourceSchema string, ...) error
- func GenCreateSchema(f *reverse.File, sourceSchema, targetSchema, nlsComp string) error
- func IWriter(f *reverse.File, w reverse.Writer) error
- func OracleTableColumnMapRule(sourceSchema, sourceTable string, column o2m.Column) (string, string, error)
- type DDL
- type O2M
- type Rule
- func (r *Rule) ChangeSchemaName() string
- func (r *Rule) ChangeTableColumnDefaultValue(dataDefault string) (string, error)
- func (r *Rule) ChangeTableColumnType(sourceSchema, sourceTable, sourceColumn string, column interface{}) (string, error)
- func (r *Rule) ChangeTableName() string
- func (r *Rule) GenCreateTableDDL() (reverseDDL string, checkKeyDDL []string, foreignKeyDDL []string, ...)
- func (r *Rule) GenTableCheckKey() (checkKeyMetas []string, err error)
- func (r *Rule) GenTableColumn() (columnMetas []string, err error)
- func (r *Rule) GenTableColumnComment() (columnComments []string, err error)
- func (r *Rule) GenTableComment() (tableComment string, err error)
- func (r *Rule) GenTableForeignKey() (foreignKeyMetas []string, err error)
- func (r *Rule) GenTableKeyMeta() (tableKeyMetas []string, compatibilityIndexSQL []string, err error)
- func (r *Rule) GenTableNormalIndex() (normalIndexMetas []string, compatibilityIndexSQL []string, err error)
- func (r *Rule) GenTablePrefix() (string, string)
- func (r *Rule) GenTablePrimaryKey() (primaryKeyMetas []string, err error)
- func (r *Rule) GenTableUniqueIndex() (uniqueIndexMetas []string, compatibilityIndexSQL []string, err error)
- func (r *Rule) GenTableUniqueKey() (uniqueKeyMetas []string, err error)
- func (r *Rule) String() string
- type Table
- func (t *Table) GenTableSuffix(primaryColumns []string, singleIntegerPK bool) (tableSuffix string, err error)
- func (t *Table) GetTableCheckKey() ([]map[string]string, error)
- func (t *Table) GetTableColumnComment() ([]map[string]string, error)
- func (t *Table) GetTableColumnMeta() ([]map[string]string, error)
- func (t *Table) GetTableComment() ([]map[string]string, error)
- func (t *Table) GetTableForeignKey() ([]map[string]string, error)
- func (t *Table) GetTableNormalIndex() ([]map[string]string, error)
- func (t *Table) GetTablePrimaryKey() ([]map[string]string, error)
- func (t *Table) GetTableUniqueIndex() ([]map[string]string, error)
- func (t *Table) GetTableUniqueKey() ([]map[string]string, error)
- func (t *Table) IsSingleIntegerPK(primaryColumns []string, columnMetas []string) bool
- func (t *Table) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenCompatibilityTable ¶
func GenCreateSchema ¶
Types ¶
type DDL ¶
type DDL struct { SourceSchemaName string `json:"source_schema"` SourceTableName string `json:"source_table_name"` SourceTableType string `json:"source_table_type"` TargetSchemaName string `json:"target_schema"` TargetTableName string `json:"target_table_name"` TargetDBType string `json:"target_db_type"` TargetDBVersion string `json:"target_db_version"` ReverseDDL string `json:"reverse_ddl"` TableSuffix string `json:"table_suffix"` TableComment string `json:"table_comment"` CheckKeyDDL []string `json:"check_key_ddl"` ForeignKeyDDL []string `json:"foreign_key_ddl"` CompatibleDDL []string `json:"compatible_ddl"` }
type O2M ¶
type O2M struct {
// contains filtered or unexported fields
}
func NewO2MReverse ¶
func (*O2M) NewReverse ¶
type Rule ¶
type Rule struct { Ctx context.Context `json:"-"` SourceSchema string `json:"source_schema"` SourceTableName string `json:"source_table_name"` TargetSchema string `json:"target_schema"` TargetTableName string `json:"target_table_name"` PrimaryKeyINFO []map[string]string `json:"primary_key_info"` UniqueKeyINFO []map[string]string `json:"unique_key_info"` ForeignKeyINFO []map[string]string `json:"foreign_key_info"` CheckKeyINFO []map[string]string `json:"check_key_info"` UniqueIndexINFO []map[string]string `json:"unique_index_info"` NormalIndexINFO []map[string]string `json:"normal_index_info"` TableCommentINFO []map[string]string `json:"table_comment_info"` TableColumnINFO []map[string]string `json:"table_column_info"` ColumnCommentINFO []map[string]string `json:"column_comment_info"` OracleCollation bool `json:"oracle_collation"` Oracle *oracle.Oracle `json:"-"` }
func (*Rule) ChangeSchemaName ¶
func (*Rule) ChangeTableColumnDefaultValue ¶
func (*Rule) ChangeTableColumnType ¶
func (r *Rule) ChangeTableColumnType(sourceSchema, sourceTable, sourceColumn string, column interface{}) (string, error)
数据库查询获取自定义表结构转换规则 加载数据类型转换规则【处理字段级别、表级别、库级别数据类型映射规则】 数据类型转换规则判断,未设置自定义规则,默认采用内置默认字段类型转换
func (*Rule) ChangeTableName ¶
func (*Rule) GenCreateTableDDL ¶
func (*Rule) GenTableCheckKey ¶
func (*Rule) GenTableColumn ¶
func (*Rule) GenTableColumnComment ¶
func (*Rule) GenTableComment ¶
func (*Rule) GenTableForeignKey ¶
func (*Rule) GenTableKeyMeta ¶
func (*Rule) GenTableNormalIndex ¶
func (*Rule) GenTablePrefix ¶
func (*Rule) GenTablePrimaryKey ¶
func (*Rule) GenTableUniqueIndex ¶
func (*Rule) GenTableUniqueKey ¶
type Table ¶
type Table struct { Ctx context.Context `json:"-"` SourceSchemaName string `json:"source_schema_name"` TargetSchemaName string `json:"target_schema_name"` SourceTableName string `json:"source_table_name"` TargetDBType string `json:"target_db_type"` TargetDBVersion string `json:"target_db_version"` TargetTableName string `json:"target_table_name"` TargetTableOption string `json:"target_table_option"` OracleCollation bool `json:"oracle_collation"` SourceSchemaCollation string `json:"source_schema_collation"` // 可为空 SourceTableCollation string `json:"source_table_collation"` // 可为空 SourceDBNLSSort string `json:"sourcedb_nlssort"` SourceDBNLSComp string `json:"sourcedb_nlscomp"` SourceTableType string `json:"source_table_type"` Overwrite bool `json:"overwrite"` Oracle *oracle.Oracle `json:"-"` MySQL *mysql.MySQL `json:"-"` }
func GenReverseTableTask ¶
func (*Table) GenTableSuffix ¶
func (t *Table) GenTableSuffix(primaryColumns []string, singleIntegerPK bool) (tableSuffix string, err error)
O2M special
func (*Table) GetTableColumnComment ¶
func (*Table) GetTableColumnMeta ¶
func (*Table) GetTableForeignKey ¶
func (*Table) GetTableNormalIndex ¶
func (*Table) GetTablePrimaryKey ¶
func (*Table) GetTableUniqueIndex ¶
func (*Table) IsSingleIntegerPK ¶
判断 Oracle 主键是否是整型主键