Documentation
¶
Index ¶
- Constants
- Variables
- func DebugDmlMsg(msgBatch []*core.Msg) (interface{}, interface{})
- func GenerateReplaceSQLWithMultipleValues(msgBatch []*core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)
- func GenerateSingleDeleteSQL(msg *core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)
- func GenerateSingleReplaceSQL(msg *core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)
- func GetBatchSize(defaultBatchSize int, DetectConflict bool, UseShadingProxy bool) (int, error)
- func GetSingleSqlPlaceHolderAndArgWithEncodedData(msg *core.Msg, tableDef *schema_store.Table) (string, []interface{}, error)
- func NewBidirectionEngine(db *sql.DB, mode utils.BidirectionMode) *bidirectionEngine
- func PlaceHoldersAndArgsFromEncodedData(msgBatch []*core.Msg, tableDef *schema_store.Table) ([]string, []interface{}, error)
- func SelectEngine(DetectConflict bool, UserBidirection bool, UseShadingProxy bool) (string, error)
- func ValidateSchema(msg *core.Msg, tableDef *schema_store.Table) error
- type MySQLExecutionEngineConfig
- type SQlExecutionEngine
- func NewConflictEngine(db *sql.DB, override bool, maxRetry int, retrySleepDuration time.Duration, ...) SQlExecutionEngine
- func NewConflictPreviewEngine(db *sql.DB, maxRetryCount int, sleepDuration time.Duration, enableDelete bool) SQlExecutionEngine
- func NewManualSQLEngine(db *sql.DB, config MySQLExecutionEngineConfig) SQlExecutionEngine
- func NewMySQLReplaceEngine(db *sql.DB) SQlExecutionEngine
- func NewSQLExecutionEngine(db *sql.DB, engineConfig MySQLExecutionEngineConfig) SQlExecutionEngine
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 GenerateSingleDeleteSQL ¶
func GetBatchSize ¶
func NewBidirectionEngine ¶
func NewBidirectionEngine(db *sql.DB, mode utils.BidirectionMode) *bidirectionEngine
func SelectEngine ¶
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 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
Click to show internal directories.
Click to hide internal directories.