mockmssql

package
v0.0.0-...-4c0385a Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDCQuerier

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

CDCQuerier implements core.CDCQuerier interface using mock data

func NewCDCQuerier

func NewCDCQuerier(handler *MockHandler) *CDCQuerier

NewCDCQuerier creates a new mock CDCQuerier

func (*CDCQuerier) GetChanges

func (q *CDCQuerier) GetChanges(ctx context.Context, captureInstance string, tableName string, fromLSN []byte, toLSN []byte) ([]cdc.Change, error)

GetChanges queries CDC changes for a table

func (*CDCQuerier) GetMaxLSN

func (q *CDCQuerier) GetMaxLSN(ctx context.Context) ([]byte, error)

GetMaxLSN returns the current max LSN

func (*CDCQuerier) GetMinLSN

func (q *CDCQuerier) GetMinLSN(ctx context.Context, captureInstance string) ([]byte, error)

GetMinLSN returns the minimum LSN for a capture instance

func (*CDCQuerier) IncrementLSN

func (q *CDCQuerier) IncrementLSN(ctx context.Context, lsn []byte) ([]byte, error)

IncrementLSN returns the next LSN after the given one

type Driver

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

Driver implements database/sql/driver.Driver

func NewDriver

func NewDriver() *Driver

NewDriver creates a new mock MSSQL driver

func (*Driver) Open

func (d *Driver) Open(name string) (driver.Conn, error)

Open returns a new connection to the mock database

type MockHandler

type MockHandler struct {
	Tables       map[string]*TableData
	MaxLSN       []byte
	CurrentLSN   []byte
	QueryResults map[string][]MockRow
}

MockHandler holds mock data and state

func HandlerForTest

func HandlerForTest() *MockHandler

HandlerForTest returns the mock handler for testing purposes

type MockRow

type MockRow map[string]interface{}

MockRow represents a single row in query results

type TableData

type TableData struct {
	Columns []string
	Rows    [][]interface{}
}

TableData holds mock table data

Jump to

Keyboard shortcuts

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