seeders

package
v2.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package seeders provides a registry-based database seeding system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names() []string

Names returns the names of all registered seeders.

func Register

func Register(s Seeder)

Register adds a seeder to the global registry.

func ResetRegistry

func ResetRegistry()

ResetRegistry clears all registered seeders. Used in tests only.

func RunAll

func RunAll(db *gorm.DB) error

RunAll executes all registered seeders in registration order.

func RunByName

func RunByName(db *gorm.DB, name string) error

RunByName executes a single seeder by name.

Types

type Seeder

type Seeder interface {
	// Name returns the seeder's unique name (used with --seeder flag).
	Name() string
	// Seed populates the database with data.
	Seed(db *gorm.DB) error
}

Seeder defines the interface for database seeders.

Jump to

Keyboard shortcuts

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