ctable

package
v4.13.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts *Options) (*genny.Generator, error)

New creates a generator to make files for a table based on the given options.

Types

type Options

type Options struct {
	// TableName is the name of the table.
	TableName string
	// Name is the name of the generated file.
	Name string
	// Path is the dir path where to generate the migration files.
	Path string
	// Attrs is a slice of columns to add to the table.
	Attrs attrs.Attrs
	// Translator is a Fizz translator to use when asking for SQL migrations.
	Translator fizz.Translator
	// Type is the type of migration to generate (sql or fizz).
	// For sql migrations, you'll have to provide a valid Translator too.
	Type string
	// ForceDefaultTimestamps enables auto timestamping for the generated table.
	ForceDefaultTimestamps bool `json:"force_default_timestamps"`
	// ForceDefaultID enables auto UUID for the generated table.
	ForceDefaultID bool `json:"force_default_id"`
}

Options for the table create generator.

func (*Options) Validate

func (opts *Options) Validate() error

Validate that options are usuable

Jump to

Keyboard shortcuts

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