Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
func (b *SQLChangeBuffer) Pop() []SQLiteWatchChange
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 ¶
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)
Click to show internal directories.
Click to hide internal directories.