sql_execution_engine

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryExist queryResult = iota
	QueryNotExist
	QueryUnknown
)
View Source
const (
	MySQLReplaceEngine       = "mysql_replace"
	BiDirectionShadingEngine = "bidirection_shading"
	BiDirectionEngine        = "bidirection"
	ConflictEngine           = "conflict"
	ManualEngine             = "manual"
)
View Source
const ConflictFileName = "conflict.log"

Variables

View Source
var ErrDeleteRowSkip = errors.New("sql_execution_engine: skip this delete event")
View Source
var ErrRowConflict = errors.New("sql_execution_engine: this row conflicts")

Functions

func DebugDmlMsg

func DebugDmlMsg(msgBatch []*core.Msg) (interface{}, interface{})

func GenerateReplaceSQLWithMultipleValues

func GenerateReplaceSQLWithMultipleValues(msgBatch []*core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)

func GenerateSingleDeleteSQL

func GenerateSingleDeleteSQL(msg *core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)

func GenerateSingleReplaceSQL

func GenerateSingleReplaceSQL(msg *core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)

func GetBatchSize

func GetBatchSize(defaultBatchSize int, DetectConflict bool, UseShadingProxy bool) (int, error)

func GetSingleSqlPlaceHolderAndArgWithEncodedData

func GetSingleSqlPlaceHolderAndArgWithEncodedData(msg *core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)

func NewBidirectionEngine

func NewBidirectionEngine(db *sql.DB, mode utils.BidirectionMode) *bidirectionEngine

func PlaceHoldersAndArgsFromEncodedData

func PlaceHoldersAndArgsFromEncodedData(msgBatch []*core.Msg, tableDef *schema_store.Table) ([]string, []interface{}, error)

func SelectEngine

func SelectEngine(DetectConflict bool, UserBidirection bool, UseShadingProxy bool) (string, error)

func ValidateSchema

func ValidateSchema(msg *core.Msg, tableDef *schema_store.Table) error

Types

type MySQLExecutionEngineConfig

type MySQLExecutionEngineConfig struct {
	EnableDDL          bool     `mapstructure:"enable-ddl" json:"enable-ddl"`
	UseBidirection     bool     `mapstructure:"use-bidirection" json:"use-bidirection"`
	UseShadingProxy    bool     `mapstructure:"use-shading-proxy"  json:"use-shading-proxy"`
	SQLExecutionEngine string   `mapstructure:"sql-execution-engine"json:"sql-execution-engine"`
	DetectConflict     bool     `mapstructure:"detect-conflict"json:"detect-conflict"`
	MaxConflictRetry   int      `mapstructure:"max-conflict-retry"json:"max-conflict-retry"`
	OverrideConflict   bool     `mapstructure:"override-conflict"json:"override-conflict"`
	SQLTemplate        string   `mapstructure:"sql-template" json:"sql-template"`
	SQLArgExpr         []string `mapstructure:"sql-arg-expr" json:"sql-arg-expr"`
}

type SQlExecutionEngine

type SQlExecutionEngine interface {
	Execute(msgBatch []*core.Msg, tableDef *schema_store.Table) error
}

func NewConflictEngine

func NewConflictEngine(db *sql.DB, override bool, maxRetry int, retrySleepDuration time.Duration, enableDelete bool) SQlExecutionEngine

func NewConflictPreviewEngine

func NewConflictPreviewEngine(db *sql.DB, maxRetryCount int, sleepDuration time.Duration, enableDelete bool) SQlExecutionEngine

func NewManualSQLEngine

func NewManualSQLEngine(db *sql.DB, config MySQLExecutionEngineConfig) SQlExecutionEngine

func NewMySQLReplaceEngine

func NewMySQLReplaceEngine(db *sql.DB) SQlExecutionEngine

func NewSQLExecutionEngine

func NewSQLExecutionEngine(db *sql.DB, engineConfig MySQLExecutionEngineConfig) SQlExecutionEngine

Jump to

Keyboard shortcuts

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