Documentation ¶
Overview ¶
Copyright © 2023 Rohit Singh rkochhar@uwaterloo.ca
Copyright © 2023 Rohit Singh rkochhar@uwaterloo.ca
Copyright © 2023 Rohit Singh rkochhar@uwaterloo.ca
Index ¶
- Variables
- func Execute()
- func GenerateContainerizationFiles(target string) error
- func GenerateGoSourceFiles(target string) error
- func GetGolangPackage(target string, packageName string) error
- func ScaffoldProject(target string, folders [][]string, readme *os.File) error
- func TemplateFile(target string, newFile string, templateFile string) error
- type Config
- type EndpointDefinition
- type FlagConfig
- type YamlConfig
Constants ¶
This section is empty.
Variables ¶
var DOCKERFILE_BASE = `` /* 654-byte string literal not displayed */
var DOCKER_COMPOSE_BASE = `version: "3.9"
services:
server:
image: server
build: .
ports:
- "4000:4000"
`
var HANDERS_BASE = `` /* 501-byte string literal not displayed */
var HANDLERS_TEST_BASE = `` /* 1685-byte string literal not displayed */
var MAIN_BASE = `` /* 1541-byte string literal not displayed */
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GenerateContainerizationFiles ¶
Creates Dockerfile and docker-compose.yaml
func GenerateGoSourceFiles ¶
Creates main.go, handlers.go and handlers_test.go
func GetGolangPackage ¶
Executes `go mod download`
func ScaffoldProject ¶
Scaffolds the project file structure and templates README documentation
Types ¶
type Config ¶
type Config interface {
// contains filtered or unexported methods
}
Config interface must contain app information collected from command flags or YAML file
type EndpointDefinition ¶
type EndpointDefinition struct { Path string `yaml:"path"` Method string `yaml:"method"` Description string `yaml:"description"` // contains filtered or unexported fields }
EndpointDefinition contains information about custom endpoints defined in YAML configuration files
func (*EndpointDefinition) GenerateHandlerFunction ¶
func (e *EndpointDefinition) GenerateHandlerFunction() string
Returns a templated string describing a handler function for the given endpoint
func (*EndpointDefinition) GenerateReadmeTableEntry ¶
func (e *EndpointDefinition) GenerateReadmeTableEntry() string
Returns a templated string to append to README.md API Endpoint table
func (*EndpointDefinition) GenerateRouterAttachment ¶
func (e *EndpointDefinition) GenerateRouterAttachment() string
Returns a templated line of code attaching handler function to path via router
type FlagConfig ¶
FlagConfig contains app information collected from command line flags
type YamlConfig ¶
type YamlConfig struct { AppName string `yaml:"appName"` Directory string `yaml:"directory"` ModName string `yaml:"modName"` Endpoints []EndpointDefinition `yaml:"endpoints"` }
YamlConfig contains app information collected from YAML configuration file