Documentation
¶
Overview ¶
Package pglogrepl provides Debezium-compatible change data capture (CDC) events from PostgreSQL write-ahead logs (WAL). It uses github.com/jackc/pglogrepl to read WAL, and then formats the changes into standardized CDC messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Publication string `json:"publication"`
Slot string `json:"slot"`
Plugin string `json:"plugin"`
// Tables to add to publication. Example:
// ["table_wo_schema", "specific_schema.example_table", "another_schema.*"]
// ["*"] or ["*.*"] for all tables in all schemas
Tables []string `json:"tables"`
Ops []Op `json:"ops"`
PartitionRoot bool `json:"partitionRoot"`
StandbyUpdateInterval time.Duration `json:"standbyUpdateInterval"`
// ReplicaIdentity configures how much old row data is captured for each table.
// not functional yet. manually execute sql to alter DEFAULT (streams primary key columns)
ReplicaIdentity map[string]ReplicaIdentity `json:"relreplident"`
BufferSize int `json:"bufferSize"`
}
Config holds replication configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
type ReplicaIdentity ¶
type ReplicaIdentity string
ReplicaIdentity specifies what row data Postgres streams during UPDATE/DELETE operations:
- Default (d): streams primary key columns
- None (n): streams no old row data
- Full (f): streams all columns
- Index (i): streams columns in specified index
Set with: ALTER TABLE table_name REPLICA IDENTITY [DEFAULT|NOTHING|FULL|USING INDEX name]
Query with: SELECT relreplident FROM pg_class WHERE oid = 'schema.table'::regclass;
const ( // ReplicaIdentityDefault streams only primary key columns ReplicaIdentityDefault ReplicaIdentity = "d" // ReplicaIdentityNothing streams no old row data ReplicaIdentityNothing ReplicaIdentity = "n" // ReplicaIdentityFull streams all columns of old rows ReplicaIdentityFull ReplicaIdentity = "f" // ReplicaIdentityIndex streams columns from a specified unique index ReplicaIdentityIndex ReplicaIdentity = "i" )
Click to show internal directories.
Click to hide internal directories.