db

package
v0.7.3-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLogNotReadyToPublish = errors.New("not ready to publish changes")
View Source
var ErrNoTableMapping = errors.New("no table mapping found")
View Source
var MarmotPrefix = "__marmot__"
View Source
var PoolSize = 4

Functions

func GetAllDBTables added in v0.3.13

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

func RestoreFrom added in v0.6.0

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) Marshal

func (e *ChangeLogEvent) Marshal() ([]byte, error)

func (*ChangeLogEvent) Unmarshal

func (e *ChangeLogEvent) Unmarshal(data []byte) 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"`
	IsPrimaryKey bool   `db:"pk"`
}

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) BackupTo

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

func (*SqliteStreamDB) CleanupChangeLogs

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

func (*SqliteStreamDB) GetPath

func (conn *SqliteStreamDB) GetPath() string

func (*SqliteStreamDB) GetRawConnection

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

func (*SqliteStreamDB) InstallCDC added in v0.3.17

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

func (*SqliteStreamDB) RemoveCDC

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

func (*SqliteStreamDB) Replicate

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

Jump to

Keyboard shortcuts

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