pkg

package
v0.0.0-...-7e572ab Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParameterError = StandardReturn{ErrorCode: 400, Message: "Parameter error"}
)

Functions

This section is empty.

Types

type Columns

type Columns struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	NotNull bool   `json:"not_null"` // 非空
}

type ConcurrentlyTask

type ConcurrentlyTask struct {
	PosName string `json:"pos_name"` // pos file name
	Pos     uint32 `json:"pos"`      // 当前任务pos
	Success bool   `json:"success"`  // 当前任务是否成功
}

type Deltas

type Deltas struct {
	Old DeltasItem `json:"old"`
	Def DeltasItem `json:"def"`
}

type DeltasItem

type DeltasItem struct {
	Database string    `json:"database"`
	Table    string    `json:"table"`
	Columns  []Columns `json:"columns"`
}

type ESConf

type ESConf struct {
}

type EventHeader

type EventHeader struct {
	Timestamp uint32 `json:"timestamp"`
	LogPos    uint32 `json:"log_pos"`
}

type HistorySchemas

type HistorySchemas struct {
	Db    string `json:"db"`
	Table string `json:"table"`

	Deltas Deltas `json:"deltas"`
}

HistorySchemas mem <=> db 需要内存和本地存储互相映射 不用太过于强调binlog schema, history deltas, new deltas

type KafkaConf

type KafkaConf struct {
	EnableSASL bool     `json:"enable_sasl"`
	Brokers    []string `json:"brokers"`
	User       string   `json:"user"`
	Password   string   `json:"password"`
}

type MQEvent

type MQEvent struct {
	Database    string                 `json:"database"`
	Table       string                 `json:"table"`
	Action      string                 `json:"action"`
	Before      map[string]interface{} `json:"before"`
	After       map[string]interface{} `json:"after"`
	OrgRow      [][]interface{}        `json:"org_row"`
	EventHeader EventHeader            `json:"event_header"`
}

type MongoDBConf

type MongoDBConf struct {
}

type MySQLConfig

type MySQLConfig struct {
	User     string `json:"user"`
	Password string `json:"password"`
	Host     string `json:"host"`
	Port     uint16 `json:"port"`
}

type MySQLSchema

type MySQLSchema struct {
	Field      string
	Type       string
	Collation  *string
	Null       string
	Key        *string
	Default    *string
	Extra      *string
	Privileges string
	Comment    *string
}

type MySQLStatus

type MySQLStatus struct {
	File              string
	Position          uint32
	Binlog_Do_DB      string
	Binlog_lgnore_DB  string
	Executed_Gtid_Set string
}

type NsqConf

type NsqConf struct {
}

type SharedSync

type SharedSync struct {
	Rw           sync.RWMutex       `json:"-"`         // 使用场景 读多写少 多任务进行变更
	Task         *Task              `json:"task"`      // 任务更新同步
	ServerID     uint32             `json:"server_id"` // mysql server_id
	PositionName string             `json:"position_name"`
	PositionPos  uint32             `json:"position_pos"`
	Context      context.Context    `json:"-"` // 结束任务
	Cancel       context.CancelFunc `json:"-"`
	StopSync     bool               `json:"stop_sync"` // 暂停任务
	ErrorMsg     string             `json:"error_msg"`
	SaveShared   chan string        `json:"-"` // 更新存储

	ConcurrentlyTask     []*ConcurrentlyTask `json:"concurrently_task_manager"` // 构成  old, new (注意 断电 消息可能重发)
	ConcurrentlyTaskBack []*ConcurrentlyTask `json:"-"`                         // 构成  old, new (注意 断电 消息可能重发)
}

SharedSync 数据共享结构 服务状态同步

type StandardReturn

type StandardReturn struct {
	ErrorCode int         `json:"error_code"`
	Message   string      `json:"message"`
	Data      interface{} `json:"data,omitempty"`
}

type Task

type Task struct {
	TaskBaseData
	KafkaConf   *KafkaConf   `json:"kafka_conf"`
	NsqConf     *NsqConf     `json:"nsq_conf"`
	MongoDBConf *MongoDBConf `json:"mongo_db_conf"`
	ESConf      *ESConf      `json:"es_conf"`
}

func (*Task) LegalVerification

func (t *Task) LegalVerification() error

type TaskBaseData

type TaskBaseData struct {
	TaskID          string              `json:"task_id"`
	MySqlConfig     MySQLConfig         `json:"mysql_config"`
	Database        []string            `json:"database"`      // default: all table
	Tables          []string            `json:"tables"`        // default: all table
	ExcludeTable    []string            `json:"exclude_table"` // 排除表 table
	DatabaseMap     map[string]struct{} `json:"database_map"`
	TablesMap       map[string]struct{} `json:"tables_map"`
	ExcludeTableMap map[string]struct{} `json:"exclude_table_map"`
}

type TaskUpdate

type TaskUpdate struct {
	TaskID       string   `json:"task_id"`
	Database     []string `json:"database"`
	Tables       []string `json:"tables"`        // default: all table
	ExcludeTable []string `json:"exclude_table"` // 排除表 table
}

func (*TaskUpdate) LegalVerification

func (t *TaskUpdate) LegalVerification() error

TODO: 添加校验

Jump to

Keyboard shortcuts

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