watch

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package watch re-introspects on DDL changes (dev mode). Preferred mechanism: a DDL event trigger NOTIFYing a channel that we LISTEN on. Fallback (no permission to create event triggers): poll the catalog hash.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	Pool         *pgxpool.Pool
	Schemas      []string
	Channel      string
	PollInterval time.Duration
	OnChange     func(cat *introspect.Catalog)
	Log          *slog.Logger
}

Watcher triggers OnChange whenever the database schema drifts.

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context) error

Run blocks until ctx is cancelled. It tries to install the event trigger; on permission failure it degrades to hash polling with a warning.

Jump to

Keyboard shortcuts

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