PostgreSQL Change Data Capture (CDC) library for Go.
go get github.com/Trendyol/go-pq-cdc-pqSee examples in the example/ directory. Snapshot bootstrapping from go-pq-cdc v1.0.3+ is supported via the cdc.snapshot block in your config. For advanced options (mode, chunkSize, etc.) check the upstream snapshot feature guide.
By default, upsert/delete queries use primary key column name id. If you have multiple tables with different primary key names, you can provide a per-table mapping via config (tablePrimaryKeys) or via options (WithTablePrimaryKeys).
Config example:
tablePrimaryKeys:
users: id
mock_data_table: id_pkOption example:
gopqcdcpq.WithTablePrimaryKeys(map[string]string{
"users": "id",
"mock_data_table": "id_pk",
})MIT