sqlite

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDriver

func InitDriver()

InitDriver ensures that the sqlite3 driver is initialized

func RegisterSQLiteWatch

func RegisterSQLiteWatch(dbName string, buffer *SQLChangeBuffer) error

Registers a hook against dbName that will populate the passed buffer with sqliteWatchChange messages each time a change is executed against the database. These messages are pre-update, so the buffer will be populated before the change is committed.

Types

type SQLChangeBuffer

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

SQLChangeBuffer accumulates sqliteWatchChanges and allows them to be popped off later when writing the changelog.

func (*SQLChangeBuffer) Add

func (b *SQLChangeBuffer) Add(change SQLiteWatchChange)

add appends a change to the end of the buffer

func (*SQLChangeBuffer) Pop

pop returns the accumulated changes and then resets the buffer

type SQLiteWatchChange

type SQLiteWatchChange struct {
	Op           int
	DatabaseName string
	TableName    string
	OldRowID     int64
	NewRowID     int64
	OldRow       []interface{}
	NewRow       []interface{}
}

func (*SQLiteWatchChange) ExtractKeys

func (c *SQLiteWatchChange) ExtractKeys(db *sql.DB) ([][]interface{}, error)

Returns the primary key values of the impacted rows by looking up the metadata in the passed db.

type SqliteDBInfo

type SqliteDBInfo struct {
	Db *sql.DB
}

func (*SqliteDBInfo) GetAllTables

func (m *SqliteDBInfo) GetAllTables(ctx context.Context) ([]schema.FamilyTable, error)

func (*SqliteDBInfo) GetColumnInfo

func (m *SqliteDBInfo) GetColumnInfo(ctx context.Context, tableNames []string) ([]schema.DBColumnInfo, error)

Jump to

Keyboard shortcuts

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