o2m

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 GenMySQLInsertSQLStmtPrefix

func GenMySQLInsertSQLStmtPrefix(targetSchemaName, targetTableName string, columns []string, safeMode bool) string

SQL Prefix 语句

func GenMySQLPrepareBindVarStmt

func GenMySQLPrepareBindVarStmt(columns, bindVarBatch int) string

SQL Prepare 语句

func GenMySQLTablePrepareStmt

func GenMySQLTablePrepareStmt(
	targetSchemaName, targetTableName string, columnFields []string, insertBatchSize int, safeMode bool) string

SQL Prepare 语句

Types

type IncrResult

type IncrResult struct {
	Task IncrTask
	Err  error
}

type IncrTask

type IncrTask struct {
	Ctx            context.Context `json:"-"`
	DBTypeS        string          `json:"db_type_s"`
	DBTypeT        string          `json:"db_type_t"`
	TaskMode       string          `json:"task_mode"`
	GlobalSCN      uint64          `json:"global_scn"`
	SourceTableSCN uint64          `json:"source_table_scn"`
	SourceSchema   string          `json:"source_schema"`
	SourceTable    string          `json:"source_table"`
	TargetSchema   string          `json:"target_schema"`
	TargetTable    string          `json:"target_table"`
	Operation      string          `json:"operation"`
	OracleRedo     string          `json:"oracle_redo"` // Oracle SQL
	MySQLRedo      []string        `json:"mysql_redo"`  // MySQL 待执行 SQL
	OperationType  string          `json:"operation_type"`
	MySQL          *mysql.MySQL    `json:"-"`
	MetaDB         *meta.Meta      `json:"-"`
}

func (*IncrTask) IncrApply

func (p *IncrTask) IncrApply() error

任务同步

func (*IncrTask) String

func (p *IncrTask) String() string

序列化

type Migrate

type Migrate struct {
	Ctx         context.Context
	Cfg         *config.Config
	Oracle      *oracle.Oracle
	OracleMiner *oracle.Oracle
	Mysql       *mysql.MySQL
	MetaDB      *meta.Meta
}

func NewFuller

func NewFuller(ctx context.Context, cfg *config.Config) (*Migrate, error)

func NewIncr

func NewIncr(ctx context.Context, cfg *config.Config) (*Migrate, error)

func (*Migrate) AdjustTableSelectColumn

func (r *Migrate) AdjustTableSelectColumn(sourceTable string, oracleCollation bool) (string, error)

func (*Migrate) Full

func (r *Migrate) Full() error

func (*Migrate) FullPartSyncTable

func (r *Migrate) FullPartSyncTable(fullPartTables []string, tableNameRule map[string]string) error

func (*Migrate) FullWaitSyncTable

func (r *Migrate) FullWaitSyncTable(fullWaitTables []string, tableNameRule map[string]string, oracleCollation bool) error

func (*Migrate) GetCustomMigrateConfig added in v1.0.17

func (r *Migrate) GetCustomMigrateConfig() map[string]config.MigrateConfig

func (*Migrate) GetTableNameRule

func (r *Migrate) GetTableNameRule() (map[string]string, error)

func (*Migrate) Incr

func (r *Migrate) Incr() error

func (*Migrate) InitWaitSyncTableChunk

func (r *Migrate) InitWaitSyncTableChunk(fullWaitTables []string, tableNameRule map[string]string, oracleCollation bool) error

type Rows

type Rows struct {
	Ctx             context.Context
	SyncMeta        meta.FullSyncMeta
	Oracle          *oracle.Oracle
	MySQL           *mysql.MySQL
	Stmt            *sql.Stmt
	SourceDBCharset string
	TargetDBCharset string
	ApplyThreads    int
	BatchSize       int
	CallTimeout     int
	SafeMode        bool
	ColumnNameS     []string
	ReadChannel     chan []map[string]interface{}
	WriteChannel    chan []interface{}
}

func NewRows

func NewRows(ctx context.Context, syncMeta meta.FullSyncMeta,
	oracle *oracle.Oracle, mysql *mysql.MySQL, stmt *sql.Stmt, sourceDBCharset string, targetDBCharset string, applyThreads, batchSize, callTimeout int, safeMode bool,
	columnNameS []string) *Rows

func (*Rows) ApplyData

func (t *Rows) ApplyData() error

func (*Rows) ProcessData

func (t *Rows) ProcessData() error

func (*Rows) ReadData

func (t *Rows) ReadData() error

Jump to

Keyboard shortcuts

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