corn

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CornConf

type CornConf struct {
	Expression string `json:"expression"` // corn表达式

	Type                string `json:"type"`                  // 数据库类型
	Host                string `json:"host"`                  // 数据库地址
	Username            string `json:"username"`              // 用户名
	Password            string `json:"password"`              // 密码
	DB                  string `json:"db"`                    // 库名称
	Schema              string `json:"schema"`                // schema
	Table               string `json:"table"`                 // 表名称
	Column              string `json:"column"`                // 字段名称
	IDColumnName        string `json:"id_column_name"`        // id字段名称
	TimestampColumnName string `json:"timestamp_column_name"` // 时间字段名称
}

type SyncConf

type SyncConf struct {
	DBOptions   *options.DBOptions
	Brokers     []string
	RedisConfig redis.RedisConf
	Sources     []*CornConf
}

type SyncMessage

type SyncMessage struct {
	Data      any    `json:"data"` // 变更后的数据
	Source    source `json:"source"`
	Operation string `json:"op"`    // 变更类型 u更新 c新建 d删除
	TimeStamp int64  `json:"ts_ms"` // 变更时间 毫秒时间戳
}

type SyncMiddleware

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

func NewSyncMiddleware

func NewSyncMiddleware(db *sql.DB, conf SyncConf) (*SyncMiddleware, error)

func (*SyncMiddleware) Close

func (s *SyncMiddleware) Close()

func (*SyncMiddleware) ConsumeMessages

func (s *SyncMiddleware) ConsumeMessages(ctx context.Context)

func (*SyncMiddleware) FullSync

func (s *SyncMiddleware) FullSync() error

func (*SyncMiddleware) ListenAndConsume

func (s *SyncMiddleware) ListenAndConsume() error

ListenAndConsume 消费端调用

func (*SyncMiddleware) ScheduleIncrementalSync

func (s *SyncMiddleware) ScheduleIncrementalSync() error

Jump to

Keyboard shortcuts

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