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 ¶
NewGenerator creates a new Generator that writes files to outputDir.
func (*Generator) Factory ¶
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.
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.