Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SubCommands ¶
SubCommands returns a list of SubCommands for the "generate"" command
Types ¶
type Model ¶
type Model struct { // Name contains the name of the Model Name string // Table contains the name of the SQL table Table string // FileName cotains the name of the file containing the model FileName string // PackageName cotains the name of the package containing the model PackageName string // FullPath cotains the path to the file containing the model FullPath string // Fields cotains all the fields of the model Fields []*ModelField // Excluded contains all the method not to generate Excluded []string // IsSingle is used to name the CRUD methods accordingly to the package // Example: here's the name of the finder by id depending on IsSingle // false, GetUserByID // true: GetByID IsSingle bool // UseUUID is used to auto-populate the ID fields UseUUID bool }
Model represent a model to generate
type ModelField ¶
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 IsSingle bool UseUUID bool }
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
func (*ModelTemplateVars) OptionalName ¶
func (mtv *ModelTemplateVars) OptionalName() string
OptionalName returns the model name if single is set to false. returns an empty string otherwise
Click to show internal directories.
Click to hide internal directories.