Documentation
¶
Overview ¶
Package project provides the functionality for creating a new Go project.
Package project provides the functionality for creating a new Go project.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( SupportedWebframeworks = []string{"chi", "echo", "fiber", "gin", "gorilla/mux", "httprouter", "standard-library"} SupportedDatabaseDrivers = []string{"mysql", "postgres", "sqlite", "mongo", "none"} )
Supported Web framework, and DB driver and its dependencies.
Functions ¶
func IsValidDatabaseDriver ¶ added in v0.3.0
IsValidDatabaseDriver check if the input is supported or not
func IsValidWebFramework ¶
isValidWebFramework check if the input is supported or not
Types ¶
type DBDriverTemplateGenerator ¶ added in v0.3.0
type DatabaseDriver ¶ added in v0.3.0
type DatabaseDriver struct {
// contains filtered or unexported fields
}
DatabaseDriver represents a database driver that can be used in the project. It includes the dependencies of the driver and a template generator.
type Docker ¶ added in v0.3.4
type Docker struct {
// contains filtered or unexported fields
}
Docker represents a dockerfile that can be used in the project. It includes the dependencies of the driver and a template generator.
type DockerTemplateGenerator ¶ added in v0.3.4
type DockerTemplateGenerator interface {
Docker() []byte
}
type ProjectConfig ¶
type ProjectConfig struct {
ProjectName string
ProjectType string
DatabaseDriver string
Docker string
DatabaseDriverMap map[string]DatabaseDriver // can be any of the supported Db Drivers
FrameworkMap map[string]WebFramework // Can be any of the supported router Packages.
DockerMap map[string]Docker // can be any of the supported Db Drivers
Exit bool
AbsolutePath string
}
ProjectConfig represents the configuration for a new Go project. It includes the project name, type, a map of web frameworks, a flag to indicate whether to exit the CLI, and the absolute path of the project.
func (*ProjectConfig) CreateMainFile ¶
func (p *ProjectConfig) CreateMainFile() error
Todo: Decompose this function into smaller ones. CreateMainFile creates the main file for the project. It creates the project directory, initializes the Go module, installs the dependencies, creates the necessary paths and files, and formats the Go code.
func (*ProjectConfig) ExitCLI ¶
func (p *ProjectConfig) ExitCLI(tprogram *tea.Program)
ExitCLI releases the terminal and exits the program if the Exit flag is set.
type WebFramework ¶
type WebFramework struct {
// contains filtered or unexported fields
}
WebFramework represents a web framework that can be used in the project. It includes the dependencies of the framework and a template generator.
type WebFrameworkTemplateGenerator ¶ added in v0.3.4
type WebFrameworkTemplateGenerator interface {
Main() []byte
Server() []byte
Routes() []byte
RoutesWithDB() []byte
ServerWithDB() []byte
}
WebFrameworkTemplateGenerator is an interface that defines the methods for generating templates for the main, server, and routes files.