Documentation
¶
Overview ¶
Package make implements the command to generate a new file
Package make implements the command to generate a new file ¶
Package make implements the command to generate a new file ¶
Package make implements the command to generate a new file ¶
Package make implements the command to generate a new file ¶
Package make implements the command to generate a new file ¶
Package make implements the command to generate a new file ¶
Package make implements the command to generate a new file
Index ¶
- Variables
- func GenerateHandler(handlerOpt HandlerOptions, args []string)
- func GenerateMigration(migrationOpt MigrationOptions, args []string)
- func GenerateModel(modelOpt ModelOptions, args []string)
- func GenerateModule(moduleOpt ModuleOptions, args []string)
- func GenerateRepository(repositoryOptions RepositoryOptions, args []string)
- func GenerateRequest(requestOpt RequestOptions, args []string)
- func GenerateResponse(responseOpt ResponseOptions, args []string)
- func GenerateService(serviceOpt ServiceOptions, args []string)
- type HandlerOptions
- type MigrationOptions
- type ModelOptions
- type ModuleOptions
- type RepositoryOptions
- type RequestOptions
- type ResponseOptions
- type ServiceOptions
Constants ¶
This section is empty.
Variables ¶
var HandlerCommand = &cobra.Command{ Use: "make:handler <name>", Short: "Make a new handler", Long: "Make a new handler", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeHandlerCommand, }
HandlerCommand is the command to generate a new handler
var MigrationCommand = &cobra.Command{ Use: "make:migration <name>", Short: "Make a new migration", Long: "Make a new migration", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeMigrationCommand, Example: `gig make:migration create_users_table`, }
MigrationCommand is the command to generate a new migration
var ModelCommand = &cobra.Command{ Use: "make:model <name>", Short: "Make a new model", Long: "Make a new model", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeModelCommand, Example: `gig make:model user || gig make:model user_address`, }
ModelCommand is the command to generate a new model
var ModuleCommand = &cobra.Command{ Use: "make:module <name>", Short: "Make a new module", Long: "Make a new module", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeModuleCommand, }
ModuleCommand is the command to generate a new module
var RepositoryCommand = &cobra.Command{ Use: "make:repository <name>", Short: "Make a new repository", Long: "Make a new repository", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeRepositoryCommand, }
RepositoryCommand is the command to generate a new repository
var RequestCommand = &cobra.Command{ Use: "make:request <name>", Short: "Make a new request", Long: "Make a new request", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeRequestCommand, }
RequestCommand is the command to generate a new request
var ResponseCommand = &cobra.Command{ Use: "make:response <name>", Short: "Make a new response", Long: "Make a new response", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeResponseCommand, }
ResponseCommand is the command to generate a new response
var ServiceCommand = &cobra.Command{ Use: "make:service <name>", Short: "Make a new service", Long: "Make a new service", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires a name argument") } regex := regexp.MustCompile(`^[a-zA-Z0-9_]+$`) if !regex.MatchString(args[0]) { return fmt.Errorf("invalid name: %s", args[0]) } return nil }, Run: runMakeServiceCommand, }
ServiceCommand is the command to generate a new service
Functions ¶
func GenerateHandler ¶
func GenerateHandler(handlerOpt HandlerOptions, args []string)
GenerateHandler is the function that will be executed when the command is called It will generate a new handler file based on the template The template will be parsed with the handlerData Accepts the name of the module as an argument
func GenerateMigration ¶ added in v1.2.0
func GenerateMigration(migrationOpt MigrationOptions, args []string)
GenerateMigration is function that will be called from another package Accept MigrationOptions and []string as an argument
func GenerateModel ¶
func GenerateModel(modelOpt ModelOptions, args []string)
GenerateModel is function that will be called from another package Accept ModelOptions and []string as an argument
func GenerateModule ¶
func GenerateModule(moduleOpt ModuleOptions, args []string)
GenerateModule is the function that will be executed when the command is called It will generate handler, model, repository, request, response, service files based on the template
func GenerateRepository ¶
func GenerateRepository(repositoryOptions RepositoryOptions, args []string)
GenerateRepository is the function that wrap generateRepository and generateRepositoryInterface Accept RepositoryOptions as an argument
func GenerateRequest ¶
func GenerateRequest(requestOpt RequestOptions, args []string)
GenerateRequest is the function that will be executed when the command is called It will generate a new request file based on the template The template will be parsed with the requestData Accepts the name of the module as an argument
func GenerateResponse ¶
func GenerateResponse(responseOpt ResponseOptions, args []string)
GenerateResponse is the function that will be executed when the command is called It will generate a new response file based on the template The template will be parsed with the responseData Accepts the name of the module as an argument
func GenerateService ¶
func GenerateService(serviceOpt ServiceOptions, args []string)
GenerateService is the function that will be executed when the command is called It will generate a new service file based on the template The template will be parsed with the serviceData Accepts the name of the module as an argument
Types ¶
type HandlerOptions ¶
handlerOptions is the options that will be parsed in the command
type MigrationOptions ¶ added in v1.2.0
type MigrationOptions struct {
Path string
}
MigrationOptions is the options that will be parsed in the command
type ModelOptions ¶
ModelOptions is the options that will be parsed in the command
type ModuleOptions ¶
type ModuleOptions struct {
CRUD bool
}
ModuleOptions is the options that will be parsed in the command
type RepositoryOptions ¶
repositoryOptions is the options that will be parsed in the command
type RequestOptions ¶
type RequestOptions struct {
Module string
}
requestOptions is the options that will be parsed in the command
type ResponseOptions ¶
responseOptions is the options that will be parsed in the command
type ServiceOptions ¶
serviceOptions is the options that will be parsed in the command