Documentation
¶
Index ¶
- func ReadYaml(path string, object interface{}) error
- type AppGenerator
- type Connection
- type ConnectorGenerator
- type ConnectorGeneratorData
- type ConnectorGeneratorDataModel
- type DatabaseGenerator
- type Definition
- type Field
- type FieldGenerator
- type FileGenerator
- type Generator
- type Group
- type GroupGenerator
- type MainGenerator
- type Model
- type ModelDefinitionGenerator
- type Param
- type Route
- type RouteDefinitionGenerator
- type RoutesGenerator
- type ServerGenerator
- type ServerRoutesGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppGenerator ¶ added in v0.8.0
AppGenerator manages generating an application
func NewAppGenerator ¶ added in v0.8.0
func NewAppGenerator(cfg *config.Config, name, repo string) *AppGenerator
NewAppGenerator returns a new instance of Generator
func (*AppGenerator) Execute ¶ added in v0.8.0
func (g *AppGenerator) Execute() error
Execute processes all of the configurations and generates an application
type Connection ¶ added in v0.8.0
type ConnectorGenerator ¶ added in v0.8.0
type ConnectorGenerator struct {
*Generator
Config *config.Config
Models []map[string]string
Data *ConnectorGeneratorData
}
ConnectorGenerator manages generation of the database connector
func NewConnectorGenerator ¶ added in v0.8.0
func NewConnectorGenerator(cfg *config.Config, models []map[string]string) *ConnectorGenerator
NewConnectorGenerator creates and returns a ConnectorGenerator
type ConnectorGeneratorData ¶ added in v0.8.0
type ConnectorGeneratorData struct {
Models []*ConnectorGeneratorDataModel
}
ConnectorGeneratorData stores the data for the database connector template
type ConnectorGeneratorDataModel ¶ added in v0.8.0
type DatabaseGenerator ¶ added in v0.8.0
DatabaseGenerator manages the generation of all database related files
func (*DatabaseGenerator) Execute ¶ added in v0.8.0
func (g *DatabaseGenerator) Execute() error
Execute configures and generates all of the database related files
type Definition ¶ added in v0.8.0
type Definition struct {
Repo string `json:"repo,omitempty" yaml:"repo,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Groups map[string]*Group `json:"groups,omitempty" yaml:"groups,omitempty"`
Routes map[string]*Route `json:"routes,omitempty" yaml:"routes,omitempty"`
}
Definition stores the configuration from the routes file
func (*Definition) FindGroup ¶ added in v0.8.0
func (d *Definition) FindGroup(name string, rest bool) *Group
func (*Definition) FindRoute ¶ added in v0.8.0
func (d *Definition) FindRoute(path string) *Route
FindRoute finds a route corresponding to the path name passed as argument
type Field ¶ added in v0.8.0
type Field struct {
Name string `yaml:"name,omitempty"`
Camel string `yaml:"camel,omitempty"`
Type string `yaml:"type,omitempty"`
Json string `yaml:"json,omitempty"`
Bson string `yaml:"bson,omitempty"`
Tags string `yaml:"tags,omitempty"`
Fields []*Field `yaml:"fields,omitempty"`
}
Field holds the data from the YAML field
type FieldGenerator ¶ added in v0.8.0
type FieldGenerator struct {
Definition *Field
// contains filtered or unexported fields
}
FieldGenerator is the generator of model fields
func (*FieldGenerator) Execute ¶ added in v0.8.0
func (f *FieldGenerator) Execute(s *bytes.Buffer) error
Execute generates the field using the template
func (*FieldGenerator) Prepare ¶ added in v0.8.0
func (f *FieldGenerator) Prepare() error
Prepare configures the data for the template
type FileGenerator ¶ added in v0.8.0
FileGenerator manages generic or simple file generation
func NewFileGenerator ¶ added in v0.8.0
func NewFileGenerator(cfg *config.Config, name string, path string, data map[string]string) *FileGenerator
NewFileGenerator creates and returns a FileGenerator
func (*FileGenerator) Execute ¶ added in v0.8.0
func (f *FileGenerator) Execute() error
Execute configures and generates a file
type Generator ¶
Generator is the base generate for all other generators
type Group ¶ added in v0.8.0
type Group struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Method string `json:"method,omitempty" yaml:"method,omitempty"`
Routes map[string]*Route `json:"routes,omitempty" yaml:"routes,omitempty"`
Rest bool `json:"rest,omitempty" yaml:"rest,omitempty"`
}
Group stores the configuration of the group
type GroupGenerator ¶ added in v0.8.0
type GroupGenerator struct {
*Generator
Config *config.Config
Output string
Name string
Definition *Group
}
GroupGenerator manages the creation of group routes
func NewGroupGenerator ¶ added in v0.8.0
func NewGroupGenerator(cfg *config.Config, name string, d *Group) *GroupGenerator
NewGroupGenerator configures and returns an instance of GroupGenerator
func (*GroupGenerator) Execute ¶ added in v0.8.0
func (g *GroupGenerator) Execute() error
Execute manages creation of group routes files with the template
type MainGenerator ¶ added in v0.8.0
Generator is the top-level generator and calls other generators
func (*MainGenerator) Execute ¶ added in v0.8.0
func (g *MainGenerator) Execute() error
Execute calls all dependent generators based on configuration
type Model ¶ added in v0.8.0
type Model struct {
Package string `yaml:"package,omitempty"`
Camel string `yaml:"camel,omitempty"`
Name string `yaml:"name,omitempty"`
Type string `yaml:"type,omitempty"`
Imports []string `yaml:"imports,omitempty"`
Fields []*Field `yaml:"fields,omitempty"`
}
Model holds the data from the YAML model
type ModelDefinitionGenerator ¶ added in v0.8.0
type ModelDefinitionGenerator struct {
*Generator
Config *config.Config
Name string
Type string
Fields []string
Definition *Model
}
ModelDefinitionGenerator manages the generation of model definitions
func NewModelDefinitionGenerator ¶ added in v0.8.0
func NewModelDefinitionGenerator(cfg *config.Config, name string, fields ...string) *ModelDefinitionGenerator
NewModelDefinitionGenerator creates and returns an instance of ModelDefinitionGenerator
func (*ModelDefinitionGenerator) Execute ¶ added in v0.8.0
func (g *ModelDefinitionGenerator) Execute() error
Execute generates the model definition
type Param ¶ added in v0.8.0
type Param struct {
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
Default string `json:"default,omitempty" yaml:"default,omitempty"`
Query bool `json:"query,omitempty" yaml:"query,omitempty"`
}
Param stores the configuration of the parameter
type Route ¶ added in v0.8.0
type Route struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Method string `json:"method,omitempty" yaml:"method,omitempty"`
Params []*Param `json:"params,omitempty" yaml:"params,omitempty"`
}
Route stores the configuration of the route
type RouteDefinitionGenerator ¶ added in v0.8.0
type RouteDefinitionGenerator struct {
*Generator
Config *config.Config
Name string
Path string
Params []string
Rest bool
Definition *Definition
}
RouteDefinitionGenerator manages the generation of and updates to routes definition
func NewRouteDefinitionGenerator ¶ added in v0.8.0
func NewRouteDefinitionGenerator(cfg *config.Config, path string, rest bool, params ...string) *RouteDefinitionGenerator
NewRouteDefinitionGenerator creates and returns an instance of RouteDefinitionGenerator
func (*RouteDefinitionGenerator) Execute ¶ added in v0.8.0
func (g *RouteDefinitionGenerator) Execute() error
Execute generates or updates the routes definition
type RoutesGenerator ¶ added in v0.8.0
type RoutesGenerator struct {
Config *config.Config
Definition *Definition
Groups []*GroupGenerator
}
RoutesGenerator manages the generation of all routes related files
func NewRoutesGenerator ¶ added in v0.8.0
func NewRoutesGenerator(cfg *config.Config) *RoutesGenerator
NewRoutesGenerator creates and returns an instance of Generator
func (*RoutesGenerator) Execute ¶ added in v0.8.0
func (g *RoutesGenerator) Execute() error
Execute generates the files from the templates
type ServerGenerator ¶ added in v0.8.0
type ServerGenerator struct {
*Generator
Config *config.Config
Output string
Definition *Definition
}
ServerGenerator manages the creation of the server file
func NewServerGenerator ¶ added in v0.8.0
func NewServerGenerator(cfg *config.Config, d *Definition) *ServerGenerator
NewServerGenerator creates and returns an instance of ServerGenerator
func (*ServerGenerator) Execute ¶ added in v0.8.0
func (g *ServerGenerator) Execute() error
Execute creates the server file from the template
type ServerRoutesGenerator ¶ added in v0.8.0
type ServerRoutesGenerator struct {
*Generator
Config *config.Config
Output string
Definition *Definition
}
ServerRoutesGenerator manages the creation of the server routes file
func NewServerRoutesGenerator ¶ added in v0.8.0
func NewServerRoutesGenerator(cfg *config.Config, d *Definition) *ServerRoutesGenerator
NewServerRoutesGenerator creates and returns an instance of ServerRoutesGenerator
func (*ServerRoutesGenerator) Execute ¶ added in v0.8.0
func (g *ServerRoutesGenerator) Execute() error
Execute creates the server routes file from the template