reader

package
v0.0.0-...-1e4b8bd Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownTableID is returned when a table ID from a rows event is
	// missing in the table map index.
	ErrUnknownTableID = errors.New("Unknown table ID")
)

Functions

This section is empty.

Types

type EnhancedReader

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

EnhancedReader is an extended version of the reader that maintains schema details to add column names and signed integers support.

func NewEnhanced

func NewEnhanced(dsn string, sc driver.Config) (*EnhancedReader, error)

NewEnhanced creates a new enhanced binary log reader.

func (*EnhancedReader) Close

func (r *EnhancedReader) Close() error

Close underlying database connection.

func (*EnhancedReader) NextRowsEvent

func (r *EnhancedReader) NextRowsEvent(ctx context.Context) (*EnhancedRowsEvent, error)

NextRowsEvent returns the next rows event for a whitelisted table. It blocks until next event is received or context is cancelled.

func (*EnhancedReader) ReadEvent

func (r *EnhancedReader) ReadEvent(ctx context.Context) (*Event, error)

ReadEvent reads next event from the binary log.

func (*EnhancedReader) Safepoint

func (r *EnhancedReader) Safepoint() binlog.Position

Safepoint returns last encountered position that is considered safe to start with.

func (*EnhancedReader) State

func (r *EnhancedReader) State() binlog.Position

State returns current position in the binary log.

func (*EnhancedReader) WhitelistTables

func (r *EnhancedReader) WhitelistTables(database string, tables ...string) error

WhitelistTables adds given tables of the given database to processing white list.

type EnhancedRowsEvent

type EnhancedRowsEvent struct {
	Header binlog.EventHeader
	Table  binlog.TableDescription
	Rows   []map[string]interface{}
}

EnhancedRowsEvent ...

type Event

type Event struct {
	Format binlog.FormatDescription
	Header binlog.EventHeader
	Buffer []byte
	Offset uint64

	// Table is not empty for rows events
	Table *binlog.TableDescription
}

Event contains binlog event details.

func (Event) DecodeRows

func (e Event) DecodeRows() (binlog.RowsEvent, error)

DecodeRows decodes buffer into a rows event.

type Reader

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

Reader is a binary log reader.

func New

func New(dsn string, sc driver.Config) (*Reader, error)

New creates a new binary log reader.

func (*Reader) Close

func (r *Reader) Close() error

Close underlying database connection.

func (*Reader) ReadEvent

func (r *Reader) ReadEvent(ctx context.Context) (*Event, error)

ReadEvent reads next event from the binary log.

func (*Reader) State

func (r *Reader) State() binlog.Position

State returns current position in the binary log.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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