introspect

package
v0.1.3-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package introspect defines schema introspection: discovering entity metadata from a live database, and detecting drift between configured and discovered schemas. The Introspector interface lives here; providers in x/ implement it. DetectDrift is pure logic and runs at startup to fail fast on mismatched configuration (a referenced column that no longer exists in the DB).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drift

type Drift struct {
	// Missing lists configured entities/fields absent from the DB
	// (entity name, or "entity.field").
	Missing []string
	// Extra lists DB columns not present in the config.
	Extra []string
	// TypeChanged lists fields whose DB type differs from the config.
	TypeChanged []string
}

Drift describes differences between configured and discovered schemas.

func DetectDrift

func DetectDrift(configured, discovered []entity.Entity) Drift

DetectDrift compares configured entities against discovered ones. A missing entity is reported by name; missing/extra fields are reported as "entity.field". It is pure and deterministic.

type Introspector

type Introspector interface {
	Discover(ctx context.Context, sources []string) ([]entity.Entity, error)
}

Introspector discovers entity metadata (tables, columns, keys, procedure parameters) from a live database. Implementations live in x/providers.

Jump to

Keyboard shortcuts

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