generator

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package generator provides migration and seeder file generation using Go text/template and embedded template files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

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

Generator generates migration and seeder files from templates.

func NewGenerator

func NewGenerator(outputDir string) *Generator

NewGenerator creates a new Generator that writes files to outputDir.

func (*Generator) Factory

func (g *Generator) Factory(description string) (string, error)

Factory generates a factory file and returns the full filepath. The filename follows the pattern description_factory.go.

func (*Generator) Migration

func (g *Generator) Migration(description string, opts MigrationOptions) (string, error)

Migration generates a migration file and returns the full filepath. The filename follows the pattern YYYYMMDDHHMMSS_description.go. The opts parameter controls whether the template includes pre-populated Schema_Builder calls for --create or --table flags.

func (*Generator) Seeder

func (g *Generator) Seeder(description string) (string, error)

Seeder generates a seeder file and returns the full filepath. The filename follows the pattern description_seeder.go.

type MigrationOptions

type MigrationOptions struct {
	// CreateTable pre-populates Up() with a Schema_Builder Create call.
	CreateTable string
	// AlterTable pre-populates Up() with a Schema_Builder Alter call.
	AlterTable string
}

MigrationOptions configures optional flags for migration generation.

Jump to

Keyboard shortcuts

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