generate

package
v0.0.0-...-a114734 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenModel

func GenModel(c *cli.Context) error

GenModel is used to generate a new model

func SubCommands

func SubCommands() []cli.Command

SubCommands returns a list of SubCommands for the "generate"" command

Types

type Model

type Model struct {
	Name        string
	Table       string
	FileName    string
	PackageName string
	Path        string
	FullPath    string
	Fields      []*ModelField
	Excluded    []string
}

Model represent a model to generate

func (*Model) Parse

func (m *Model) Parse() error

Parse parses and render a model

type ModelField

type ModelField struct {
	Name   string
	DbName string
}

ModelField represents a field from the struct we are parsing

type ModelTemplateVars

type ModelTemplateVars struct {
	ModelName      string
	ModelNameLC    string
	TableName      string
	ModelVar       string
	PackageName    string
	CreateStmt     string
	CreateStmtArgs string
	UpdateStmt     string
	UpdateStmtArgs string
	FieldsAsArray  string
	Excluded       []string
}

ModelTemplateVars contains all the variable needed to render the new file

func (*ModelTemplateVars) Generate

func (mtv *ModelTemplateVars) Generate(wanted string) bool

Generate returns true if the element has not been excluded

Jump to

Keyboard shortcuts

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