db

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEndOfWatch = errors.New("watching event finished")
View Source
var ErrLogNotReadyToPublish = errors.New("not ready to publish changes")
View Source
var ErrNoTableMapping = errors.New("no table mapping found")
View Source
var HarmonyLitePrefix = "__harmonylite__"
View Source
var PoolSize = 4

Functions

func GetAllDBTables

func GetAllDBTables(path string) ([]string, error)

func RestoreFrom

func RestoreFrom(destPath, bkFilePath string) error

Types

type ChangeLogEvent

type ChangeLogEvent struct {
	Id        int64
	Type      string
	TableName string
	Row       map[string]any
	// contains filtered or unexported fields
}

func (ChangeLogEvent) Hash

func (e ChangeLogEvent) Hash() (uint64, error)

func (ChangeLogEvent) Unwrap

func (e ChangeLogEvent) Unwrap() (ChangeLogEvent, error)

func (ChangeLogEvent) Wrap

func (e ChangeLogEvent) Wrap() (ChangeLogEvent, error)

type ChangeLogState

type ChangeLogState = int16
const (
	Pending   ChangeLogState = 0
	Published ChangeLogState = 1
	Failed    ChangeLogState = -1
)

type ColumnInfo

type ColumnInfo struct {
	Name            string `db:"name"`
	Type            string `db:"type"`
	NotNull         bool   `db:"notnull"`
	DefaultValue    any    `db:"dflt_value"`
	PrimaryKeyIndex int    `db:"pk"`
	IsPrimaryKey    bool
}

type EnhancedRows

type EnhancedRows struct {
	*sql.Rows
}

func (*EnhancedRows) Finalize

func (rs *EnhancedRows) Finalize()

type EnhancedStatement

type EnhancedStatement struct {
	*sql.Stmt
}

func (*EnhancedStatement) Finalize

func (stmt *EnhancedStatement) Finalize()

type SqliteStreamDB

type SqliteStreamDB struct {
	OnChange func(event *ChangeLogEvent) error
	// contains filtered or unexported fields
}

func OpenStreamDB

func OpenStreamDB(path string) (*SqliteStreamDB, error)

func (*SqliteStreamDB) AreCDCHooksInstalled added in v0.9.1

func (conn *SqliteStreamDB) AreCDCHooksInstalled() bool

AreCDCHooksInstalled checks if the CDC hooks are installed

func (*SqliteStreamDB) BackupTo

func (conn *SqliteStreamDB) BackupTo(bkFilePath string) error

func (*SqliteStreamDB) CleanupChangeLogs

func (conn *SqliteStreamDB) CleanupChangeLogs(beforeTime time.Time) (int64, error)

func (*SqliteStreamDB) DB added in v0.9.1

func (conn *SqliteStreamDB) DB() interface{}

DB returns the underlying database for health check purposes

func (*SqliteStreamDB) GetPath

func (conn *SqliteStreamDB) GetPath() string

func (*SqliteStreamDB) GetRawConnection

func (conn *SqliteStreamDB) GetRawConnection() *sqlite3.SQLiteConn

func (*SqliteStreamDB) GetTrackedTablesCount added in v0.9.1

func (conn *SqliteStreamDB) GetTrackedTablesCount() int

GetTrackedTablesCount returns the number of tables being tracked

func (*SqliteStreamDB) InstallCDC

func (conn *SqliteStreamDB) InstallCDC(tables []string) error

func (*SqliteStreamDB) IsConnected added in v0.9.1

func (conn *SqliteStreamDB) IsConnected() bool

IsConnected checks if the database connection is alive

func (*SqliteStreamDB) RemoveCDC

func (conn *SqliteStreamDB) RemoveCDC(tables bool) error

func (*SqliteStreamDB) Replicate

func (conn *SqliteStreamDB) Replicate(event *ChangeLogEvent) error

func (*SqliteStreamDB) WithReadTx

func (conn *SqliteStreamDB) WithReadTx(cb func(tx *sql.Tx) error) error

Jump to

Keyboard shortcuts

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