mysql

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDCConfig

type CDCConfig struct {
	SourceID       string            `json:"source_id" yaml:"source_id"`
	Host           string            `json:"host" yaml:"host"`
	Port           int               `json:"port" yaml:"port"`
	User           string            `json:"user" yaml:"user"`
	Password       string            `json:"password" yaml:"password"`
	Flavor         string            `json:"flavor" yaml:"flavor"` // mysql or mariadb
	ServerID       uint32            `json:"server_id" yaml:"server_id"`
	Database       string            `json:"database" yaml:"database"`
	Tables         []string          `json:"tables" yaml:"tables"`
	Operations     []string          `json:"operations" yaml:"operations"`
	SchemaMapping  map[string]string `json:"schema_mapping" yaml:"schema_mapping"`
	StartFile      string            `json:"start_file" yaml:"start_file"`
	StartPos       uint32            `json:"start_pos" yaml:"start_pos"`
	GTID           string            `json:"gtid" yaml:"gtid"`
	CheckpointPath string            `json:"checkpoint_path" yaml:"checkpoint_path"`
	DSN            string            `json:"dsn" yaml:"dsn"`
	BufferSize     int               `json:"buffer_size" yaml:"buffer_size"`
	Timeout        time.Duration     `json:"timeout" yaml:"timeout"`
}

CDCConfig holds MySQL CDC configuration.

type CDCFactory

type CDCFactory struct{}

Factory for MySQL CDC sources.

func (*CDCFactory) Create

func (*CDCFactory) GetConfigSchema

func (f *CDCFactory) GetConfigSchema() adapters.ConfigSchema

func (*CDCFactory) ValidateConfig

func (f *CDCFactory) ValidateConfig(config adapters.SourceConfig) error

type CDCSource

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

CDCSource implements MySQL binlog streaming.

func NewCDCSource

func NewCDCSource(config *CDCConfig) (*CDCSource, error)

NewCDCSource creates a new MySQL CDC source.

func (*CDCSource) GetMetadata

func (c *CDCSource) GetMetadata() adapters.SourceMetadata

GetMetadata returns source metadata.

func (*CDCSource) GetSourceSchema

func (c *CDCSource) GetSourceSchema() *adapters.Schema

GetSourceSchema returns schema metadata.

func (*CDCSource) HealthCheck

func (c *CDCSource) HealthCheck() error

HealthCheck checks connectivity.

func (*CDCSource) Start

func (c *CDCSource) Start(ctx context.Context) error

Start opens connections and begins reading binlog events.

func (*CDCSource) Stop

func (c *CDCSource) Stop(ctx context.Context) error

Stop stops the CDC stream.

func (*CDCSource) Subscribe

func (c *CDCSource) Subscribe(ctx context.Context, factTypes []string) (<-chan *adapters.TypedFact, error)

Subscribe starts the CDC stream.

type ChangeEvent

type ChangeEvent struct {
	Operation string                 `json:"operation"`
	Schema    string                 `json:"schema"`
	Table     string                 `json:"table"`
	Before    map[string]interface{} `json:"before,omitempty"`
	After     map[string]interface{} `json:"after,omitempty"`
	Binlog    string                 `json:"binlog"`
	Pos       uint32                 `json:"pos"`
	Timestamp time.Time              `json:"timestamp"`
}

ChangeEvent represents a MySQL change event.

Jump to

Keyboard shortcuts

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