Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
Repo string `json:"repo" yaml:"repo"`
Name string `json:"name" yaml:"name"`
Groups map[string]*Group `json:"groups" yaml:"groups"`
Routes map[string]*Route `json:"routes" yaml:"routes"`
}
Definition stores the configuration from the routes file
func (*Definition) FindRoute ¶
func (d *Definition) FindRoute(name string) *Route
FindRoute finds a route corresponding to the path name passed as argument
type Generator ¶
type Generator struct {
Config *config.Config
Definition *Definition
Groups []*GroupGenerator
}
Generator manages the generation of all routes related files
func NewGenerator ¶
NewGenerator creates and returns an instance of Generator
type Group ¶
type Group struct {
Repo string `json:"repo" yaml:"repo"`
Name string `json:"name" yaml:"name"`
Path string `json:"path" yaml:"path"`
Method string `json:"method" yaml:"method"`
Routes map[string]*Route `json:"routes" yaml:"routes"`
Rest bool `json:"rest" yaml:"rest"`
}
Group stores the configuration of the group
type GroupGenerator ¶
type GroupGenerator struct {
*base.Generator
Config *config.Config
Output string
Name string
Definition *Group
}
GroupGenerator manages the creation of group routes
func NewGroupGenerator ¶
func NewGroupGenerator(cfg *config.Config, name string, d *Group) *GroupGenerator
NewGroupGenerator configures and returns an instance of GroupGenerator
func (*GroupGenerator) Execute ¶
func (g *GroupGenerator) Execute() error
Execute manages creation of group routes files with the template
type Param ¶
type Param struct {
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
Default string `json:"default" yaml:"default"`
}
Param stores the configuration of the parameter
type Route ¶
type Route struct {
Repo string `json:"repo" yaml:"repo"`
Name string `json:"name" yaml:"name"`
Path string `json:"path" yaml:"path"`
Method string `json:"method" yaml:"method"`
Params []*Param `json:"params" yaml:"params"`
}
Route stores the configuration of the route
type ServerGenerator ¶
type ServerGenerator struct {
*base.Generator
Config *config.Config
Output string
Definition *Definition
}
ServerGenerator manages the creation of the server file
func NewServerGenerator ¶
func NewServerGenerator(cfg *config.Config, d *Definition) *ServerGenerator
NewServerGenerator creates and returns an instance of ServerGenerator
func (*ServerGenerator) Execute ¶
func (g *ServerGenerator) Execute() error
Execute creates the server file from the template
type ServerRoutesGenerator ¶
type ServerRoutesGenerator struct {
*base.Generator
Config *config.Config
Output string
Definition *Definition
}
ServerRoutesGenerator manages the creation of the server routes file
func NewServerRoutesGenerator ¶
func NewServerRoutesGenerator(cfg *config.Config, d *Definition) *ServerRoutesGenerator
NewServerRoutesGenerator creates and returns an instance of ServerRoutesGenerator
func (*ServerRoutesGenerator) Execute ¶
func (g *ServerRoutesGenerator) Execute() error
Execute creates the server routes file from the template