Documentation
¶
Overview ¶
Package seed implements the DB seeding fixtures system for nSelf projects. Seeds are SQL files organized by environment and fixture type, with support for idempotent and destructive headers, dependency ordering, and verification.
Index ¶
Constants ¶
const ( HeaderIdempotent = "-- +seed:idempotent" HeaderDestructive = "-- +seed:destructive" HeaderDependsOn = "-- +seed:depends-on " )
SeedHeader directives parsed from SQL comments.
Variables ¶
This section is empty.
Functions ¶
func FixtureDir ¶
FixtureDir returns the directory for a specific fixture.
func ListFixtures ¶
ListFixtures returns available fixture names.
Types ¶
type GraphNode ¶
GraphNode represents a seed file in the dependency graph.
func DependencyGraph ¶
DependencyGraph returns the seed files with their dependency relationships as a printable adjacency list.
type SeedFile ¶
type SeedFile struct {
Path string
Name string
Env string // _common, dev, staging, prod, or fixture name
Idempotent bool
Destructive bool
DependsOn []string
}
SeedFile describes a single seed SQL file with parsed metadata.
func CollectForRun ¶
CollectForRun returns the ordered list of seed files to execute for a given environment and optional fixture. Order: _common first, then env-specific, then fixture if specified.
func ParseHeader ¶
ParseHeader reads a seed file and extracts its metadata headers.