config

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 13 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Heartbeat        HeartbeatConfig    `json:"heartbeat" yaml:"heartbeat"`
	Logger           LoggerConfig       `json:"logger" yaml:"logger"`
	Host             string             `json:"host" yaml:"host"`
	Username         string             `json:"username" yaml:"username"`
	Password         string             `json:"password" yaml:"password"`
	Database         string             `json:"database" yaml:"database"`
	Publication      publication.Config `json:"publication" yaml:"publication"`
	Slot             slot.Config        `json:"slot" yaml:"slot"`
	Snapshot         SnapshotConfig     `json:"snapshot" yaml:"snapshot"`
	Port             int                `json:"port" yaml:"port"`
	Metric           MetricConfig       `json:"metric" yaml:"metric"`
	DebugMode        bool               `json:"debugMode" yaml:"debugMode"`
	ExtensionSupport ExtensionSupport   `json:"extensionSupport" yaml:"extensionSupport"`
}

func ReadConfigJSON

func ReadConfigJSON(path string) (Config, error)

func ReadConfigYAML

func ReadConfigYAML(path string) (Config, error)

func (*Config) DSN

func (c *Config) DSN() string

DSN returns a normal PostgreSQL connection string for regular database operations (publication, metadata, snapshot chunks, etc.)

func (*Config) DSNWithoutSSL

func (c *Config) DSNWithoutSSL() string

func (*Config) GetSnapshotTables added in v1.0.3

func (c *Config) GetSnapshotTables(publicationInfo *publication.Config) (publication.Tables, error)

GetSnapshotTables returns the tables to snapshot based on the configuration and publication info. For snapshot_only mode: uses snapshot.tables (independent from publication) For initial mode (snapshot + CDC):

  • If snapshot.tables specified: validates it's a subset of publication tables and returns snapshot.tables
  • If snapshot.tables not specified: returns all tables from publication

func (*Config) IsSnapshotOnlyMode added in v1.0.3

func (c *Config) IsSnapshotOnlyMode() bool

IsSnapshotOnlyMode returns true if snapshot is enabled and mode is snapshot_only

func (*Config) Print

func (c *Config) Print()

func (*Config) ReplicationDSN added in v1.0.3

func (c *Config) ReplicationDSN() string

ReplicationDSN returns a replication connection string for CDC streaming This connection counts against max_wal_senders limit

func (*Config) SetDefault

func (c *Config) SetDefault()

func (*Config) Validate

func (c *Config) Validate() error

type ExtensionSupport added in v1.0.3

type ExtensionSupport struct {
	EnableTimeScaleDB bool `json:"enableTimeScaleDB" yaml:"EnableTimeScaleDB"`
}

type HeartbeatConfig added in v1.0.4

type HeartbeatConfig struct {
	Query    string        `json:"query" yaml:"query"`
	Interval time.Duration `json:"interval" yaml:"interval"`
	Enabled  bool          `json:"enabled" yaml:"enabled"`
}

type LoggerConfig

type LoggerConfig struct {
	Logger   logger.Logger `json:"-" yaml:"-"`         // custom logger
	LogLevel slog.Level    `json:"level" yaml:"level"` // if custom logger is nil, set the slog log level
}

type MetricConfig

type MetricConfig struct {
	Port int `json:"port" yaml:"port"`
}

type SnapshotConfig added in v1.0.3

type SnapshotConfig struct {
	Mode              SnapshotMode       `json:"mode" yaml:"mode"`
	InstanceID        string             `json:"instanceId" yaml:"instanceId"`
	ID                string             `json:"id" yaml:"id"`
	Tables            publication.Tables `json:"tables" yaml:"tables"`
	ChunkSize         int64              `json:"chunkSize" yaml:"chunkSize"`
	ClaimTimeout      time.Duration      `json:"claimTimeout" yaml:"claimTimeout"`
	HeartbeatInterval time.Duration      `json:"heartbeatInterval" yaml:"heartbeatInterval"`
	Enabled           bool               `json:"enabled" yaml:"enabled"`
	Resnapshot        bool               `json:"resnapshot" yaml:"resnapshot"`
}

func (*SnapshotConfig) Validate added in v1.0.3

func (s *SnapshotConfig) Validate() error

type SnapshotMode added in v1.0.3

type SnapshotMode string
const (
	SnapshotModeInitial      SnapshotMode = "initial"
	SnapshotModeNever        SnapshotMode = "never"
	SnapshotModeSnapshotOnly SnapshotMode = "snapshot_only"
)

Jump to

Keyboard shortcuts

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