Documentation
¶
Overview ¶
Package pkg implements list function and variable that can be used by other packages
Package pkg implements list function and variable that can be used by other packages ¶
Package pkg implements list function and variable that can be used by other packages ¶
Package pkg implements list function and variable that can be used by other packages ¶
Package pkg implements list function and variable that can be used by other packages ¶
Package pkg implements list function and variable that can be used by other packages ¶
Package pkg implements list function and variable that can be used by other packages
Index ¶
- Constants
- Variables
- func GenerateFile(templateType string, fileName string, moduleName string, ...)
- func GitClone(projectName, templateType string) error
- func PluralizeSnakeCase(word string) string
- func ReadJsonBool(key string) (bool, error)
- func ReadJsonString(key string) (string, error)
- func Replace(path, old, new string)
- func SnakeToCamel(snakeCase string) string
- func SnakeToPascal(snakeCase string) string
- func StringTitle(str string) string
- type CreateCommandAnswer
Constants ¶
const LatestGoVersion = "1.20"
Variables ¶
var CLIVersion = "1.2.0"
CLIVersion is the version of the GIG CLI
var CreateSurveyQuestion = []*survey.Question{ { Name: "http_framework", Prompt: &survey.Select{ Message: "Choose a framework:", Options: []string{ "gin", }, Default: "gin", PageSize: 10, }, Validate: survey.Required, }, { Name: "database", Prompt: &survey.Select{ Message: "Choose database", Options: []string{ "mysql", "postgresql", }, Default: "mysql", PageSize: 10, }, Validate: survey.Required, }, { Name: "use_orm", Prompt: &survey.Confirm{ Message: "Do you want to use GORM?", Default: false, }, }, }
CreateSurveyQuestion is the list of questions that will be asked to the user
var SupportedGoVersions = []string{"1.20", "1.19", "1.18"}
Functions ¶
func GenerateFile ¶
func GenerateFile(templateType string, fileName string, moduleName string, templateContent string, templateData any, path ...string)
GenerateFile generates a file from a template Accepts templateType, fileName, moduleName, templateContent, templateData
func GitClone ¶
Git clone template project from repository Accepts projectName, templateType Returns error
func PluralizeSnakeCase ¶
PluralizeSnakeCase converts snake_case to plural snake_case Accepts snakeCase as string Returns string Example: snake_case -> snake_cases
func ReadJsonBool ¶
ReadJsonBool reads a bool from a JSON file Accepts key as string Returns bool, error
func ReadJsonString ¶
ReadJsonString reads a string from a JSON file Accepts key as string Returns string, error
func Replace ¶
func Replace(path, old, new string)
Replace replaces oldString with the newString in all files in the path Accepts path, oldString, newString as string
func SnakeToCamel ¶
SnakeToCamel converts snake_case to camelCase Accepts snakeCase as string Returns string Example: snake_case -> snakeCase
func SnakeToPascal ¶
SnakeToCamel converts snake_case to camelCase Accepts snakeCase as string Returns string Example: snake_case -> SnakeCase
func StringTitle ¶
StringTitle converts a string to title case Accepts str as string Returns string Example: hello world -> Hello World
Types ¶
type CreateCommandAnswer ¶
type CreateCommandAnswer struct { HttpFramework string `survey:"http_framework"` Database string `survey:"database"` UseOrm bool `survey:"use_orm"` }
CreateCommandAnswer is the answer from the create command