seeder

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package seeder provides the database seeder system for OniWorks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner manages and executes seeders.

func New

func New() *Runner

New creates a Seeder Runner.

func (*Runner) Register

func (r *Runner) Register(name string, s Seeder) *Runner

Register adds a seeder to the runner.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, db *database.DB) error

Run runs all registered seeders in registration order.

func (*Runner) RunOne

func (r *Runner) RunOne(ctx context.Context, db *database.DB, name string) error

RunOne runs a single seeder by name.

type Seeder

type Seeder interface {
	// Run populates the database with seed data. It receives the live
	// *database.DB so it has the full query-builder API (Insert, InsertMap,
	// Table, transactions, …).
	Run(ctx context.Context, db *database.DB) error
}

Seeder is the interface all seeder structs must implement.

Jump to

Keyboard shortcuts

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