Documentation
¶
Index ¶
- Constants
- Variables
- func AddSQLChange(conn *sqlite3.SQLiteConn, sql string, args []any) error
- func Backup(ctx context.Context, dsn string, memory bool, w io.Writer) error
- func Deserialize(ctx context.Context, file string) error
- func DeserializeFromReader(ctx context.Context, r io.Reader) error
- func Filename(ctx context.Context) (string, error)
- func RegisterDriver(extensions []string, name string, pub CDCPublisher)
- func RemoveLastChange(conn *sqlite3.SQLiteConn) error
- func SetGlobalDB(database *sql.DB)
- type CDCPublisher
- type Change
- type ChangeSet
- type Request
- type Response
- type Statement
- func (s *Statement) Begin() bool
- func (s *Statement) Columns() []string
- func (s *Statement) Commit() bool
- func (s *Statement) DDL() bool
- func (s *Statement) HasDistinct() bool
- func (s *Statement) HasReturning() bool
- func (s *Statement) IsCreateTable() bool
- func (s *Statement) IsDelete() bool
- func (s *Statement) IsExplain() bool
- func (s *Statement) IsInsert() bool
- func (s *Statement) IsSelect() bool
- func (s *Statement) IsUpdate() bool
- func (s *Statement) Parameters() []string
- func (s *Statement) Rollback() bool
- func (s *Statement) Source() string
- func (s *Statement) Type() string
Constants ¶
View Source
const ( TypeExplain = "EXPLAIN" TypeSelect = "SELECT" TypeInsert = "INSERT" TypeUpdate = "UPDATE" TypeDelete = "DELETE" TypeCreateTable = "CREATE TABLE" TypeCreateIndex = "CREATE INDEX" TypeCreateView = "CREATE VIEW" TypeCreateTrigger = "CREATE TRIGGER" TypeCreateVirtualTable = "CREATE VIRTUAL TABLE" TypeAlterTable = "ALTER TABLE" TypeVacuum = "VACUUM" TypeDrop = "DROP" TypeAnalyze = "ANALYZE" TypeBegin = "BEGIN" TypeCommit = "COMMIT" TypeRollback = "ROLLBACK" TypeSavepoint = "SAVEPOINT" TypeRelease = "RELEASE" TypeOther = "OTHER" )
Variables ¶
View Source
var (
ErrInvalidSQL = fmt.Errorf("invalid SQL")
)
Functions ¶
func AddSQLChange ¶ added in v0.0.7
func AddSQLChange(conn *sqlite3.SQLiteConn, sql string, args []any) error
func DeserializeFromReader ¶ added in v0.0.9
func RegisterDriver ¶
func RegisterDriver(extensions []string, name string, pub CDCPublisher)
func RemoveLastChange ¶ added in v0.0.7
func RemoveLastChange(conn *sqlite3.SQLiteConn) error
func SetGlobalDB ¶
Types ¶
type CDCPublisher ¶
type Change ¶
type Change struct {
Database string `json:"database,omitempty"`
Table string `json:"table,omitempty"`
Columns []string `json:"columns,omitempty"`
Operation string `json:"operation"` // "INSERT", "UPDATE", "DELETE", "SQL"
OldRowID int64 `json:"old_rowid,omitempty"`
NewRowID int64 `json:"new_rowid,omitempty"`
OldValues []any `json:"old_values,omitempty"`
NewValues []any `json:"new_values,omitempty"`
SQL string `json:"sql,omitempty"`
SQLArgs []any `json:"sql_args,omitempty"`
}
type ChangeSet ¶
type ChangeSet struct {
Node string `json:"node"`
ProcessID int64 `json:"process_id"`
Changes []Change `json:"changes"`
Timestamp int64 `json:"timestamp_ns"`
}
func NewChangeSet ¶
func (*ChangeSet) Send ¶
func (cs *ChangeSet) Send(pub CDCPublisher) error
type Response ¶
type Response struct {
Columns []string `json:"columns"`
Rows [][]any `json:"rows"`
RowsAffected int64 `json:"-"`
NoReturning bool `json:"-"`
}
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
func (*Statement) HasDistinct ¶
func (*Statement) HasReturning ¶
func (*Statement) IsCreateTable ¶
func (*Statement) Parameters ¶
Click to show internal directories.
Click to hide internal directories.