monitor

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(webhookURL string, result *DriftResult) error

Alert sends a drift result to a webhook URL (Pro feature). Supports Slack Block Kit (when URL contains "hooks.slack.com") and generic JSON.

func AppendReport

func AppendReport(path string, result *DriftResult) error

AppendReport appends a DriftResult as a single JSON line to a JSONL file. Creates the file and parent directories if they don't exist.

func Save

func Save(path string, snap *Snapshot) error

Save writes a snapshot to disk.

Types

type DriftResult

type DriftResult struct {
	Source     string           `json:"source"`
	BaselineAt time.Time        `json:"baseline_at"`
	CheckedAt  time.Time        `json:"checked_at"`
	HasDrift   bool             `json:"has_drift"`
	Changes    []diff.TableDiff `json:"changes,omitempty"`
}

DriftResult is the outcome of comparing a live schema against a baseline snapshot.

func Check

func Check(source string, snap *Snapshot, current *schema.Schema) *DriftResult

Check compares currentSchema against the snapshot baseline.

type HistoryEntry

type HistoryEntry struct {
	*DriftResult
}

HistoryEntry is one line from a JSONL report file.

func LoadHistory

func LoadHistory(path string) ([]HistoryEntry, error)

LoadHistory reads all entries from a JSONL report file, sorted by CheckedAt ascending.

type HistorySummary

type HistorySummary struct {
	Source      string
	TotalChecks int
	DriftCount  int
	LastChecked string
	LastDrift   string
}

HistorySummary aggregates stats across all history entries.

func Summarize

func Summarize(entries []HistoryEntry) HistorySummary

type Snapshot

type Snapshot struct {
	Version    int            `json:"version"`
	Source     string         `json:"source"`
	CapturedAt time.Time      `json:"captured_at"`
	Schema     *schema.Schema `json:"schema"`
}

Snapshot is a point-in-time record of a database schema.

func Load

func Load(path string) (*Snapshot, error)

Load reads a snapshot from disk.

Jump to

Keyboard shortcuts

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