o2m

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 23 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.

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 语句

func IApplier

func IApplier(r migrate.Applier) error

func IExtractor

func IExtractor(e migrate.Extractor) ([]string, []string, error)

func ITranslator

func ITranslator(t migrate.Translator) error

Types

type Chunk

type Chunk struct {
	Ctx           context.Context
	SyncMeta      model.FullSyncMeta
	ApplyThreads  int
	BatchSize     int
	SafeMode      bool
	MySQL         *mysql.MySQL
	Oracle        *oracle.Oracle
	SourceColumns []string
	BatchResults  []string
}

func NewChunk

func NewChunk(ctx context.Context, syncMeta model.FullSyncMeta,
	oracle *oracle.Oracle, mysql *mysql.MySQL,
	sourceColumns, batchResults []string, applyThreads, batchSize int, safeMode bool) *Chunk

func (*Chunk) ApplyTableRows

func (t *Chunk) ApplyTableRows() error

func (*Chunk) TranslateTableRows

func (t *Chunk) TranslateTableRows() error

type IncrResult

type IncrResult struct {
	Task   IncrTask
	Status bool
}

type IncrTask

type IncrTask struct {
	Ctx            context.Context `json:"-"`
	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:"-"`
}

func (*IncrTask) IncrApply

func (p *IncrTask) IncrApply() error

任务同步

func (*IncrTask) String

func (p *IncrTask) String() string

序列化

type Job

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

func NewScheduleJob

func NewScheduleJob(size int, lcMap map[string][]logminer, done func()) *Job

func (*Job) AddData

func (j *Job) AddData(data logminer)

func (*Job) Close

func (j *Job) Close()

func (*Job) Schedule

func (j *Job) Schedule()

type O2M

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

func NewO2MFuller

func NewO2MFuller(ctx context.Context, cfg *config.Config, oracle *oracle.Oracle, mysql *mysql.MySQL) *O2M

func NewO2MIncr

func NewO2MIncr(ctx context.Context, cfg *config.Config, oracle *oracle.Oracle, mysql *mysql.MySQL) *O2M

func (*O2M) NewFuller

func (r *O2M) NewFuller() error

func (*O2M) NewIncr

func (r *O2M) NewIncr() error

type Stmt

type Stmt struct {
	Schema    string
	Table     string
	Columns   []string
	Operation string
	Data      map[string]interface{}
	Before    map[string]interface{}
	WhereExpr string
}

func (*Stmt) Enter

func (v *Stmt) Enter(in ast.Node) (ast.Node, bool)

WARNING: sql parser Format() has be discrepancy ,be is instead of Restore()

func (*Stmt) Leave

func (v *Stmt) Leave(in ast.Node) (ast.Node, bool)

func (*Stmt) Marshal

func (v *Stmt) Marshal() string

type Table

type Table struct {
	Ctx       context.Context
	SyncMeta  model.FullSyncMeta
	Oracle    *oracle.Oracle
	BatchSize int
}

func NewTable

func NewTable(ctx context.Context, syncMeta model.FullSyncMeta,
	oracle *oracle.Oracle, batchSize int) *Table

func (*Table) GetTableRows

func (t *Table) GetTableRows() ([]string, []string, error)

Jump to

Keyboard shortcuts

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