Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBuilderFunc(table configmodels.Table) string
- func CreateFileForType(fLocation FileLocation, fname string, ext FileExtension) *os.File
- func CreatePathIfNotExists(path string)
- func FirstToLower(s string) string
- func GetBuilderFunc(table configmodels.Table) string
- func GetHandlerLogicMethodString(name string) string
- func GetLogicMethod(name string) configmodels.Method
- func GetMethodSignatureByName(name string) string
- func GetMethodSignatureByValue(name string, args datastructures.OrderedMap[string, string], returns string) string
- func GetModelByName(modelName string) configmodels.Model
- func IsLastIndexInMap[K string, V any](m map[K]V, index int) bool
- func IsLastIndexInSlice[T any](arr []T, index int) bool
- func RunCleanupShellCommands(appName string, appPath string)
- func TypeOf(str string) string
- func ZeroReturnValues(returns string) string
- func ZeroValue(valueType string) string
- type FileExtension
- type FileLocation
Constants ¶
View Source
const ( String = "string" Error = "error" Integer = "int" Float = "float64" Boolean = "bool" )
Variables ¶
View Source
var TemplateFuncs = template.FuncMap(map[string]any{ "GetServiceName": func() string { return config.GetConfig().AppConfig["AppName"] }, "GetModuleName": func() string { return config.GetConfig().Name }, "ToConfigCase": func(str string) string { var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)") var matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])") snake := matchFirstCap.ReplaceAllString(str, "${1}_${2}") snake = matchAllCap.ReplaceAllString(snake, "${1}_${2}") return strings.ToUpper(snake) }, "TypeOf": TypeOf, "TitleCasedTypeOf": func(str string) string { return cases.Title(language.English).String(TypeOf(str)) }, "IsString": func(str string) bool { return TypeOf(str) == "string" }, "FirstToLower": FirstToLower, "ToTitle": cases.Title(language.English).String, "GetFirstLetter": func(str string) string { return strings.ToLower(string(str[0])) }, "IsLastIndexInMap": IsLastIndexInMap[string, string], "IsLastIndexInSlice": IsLastIndexInSlice[string], "SliceContains": slices.Contains[[]string, string], "IsNotEmpty": func(array []configmodels.Service) bool { return len(array) > 0 }, "ZeroValue": ZeroValue, "ZeroReturnValues": ZeroReturnValues, "GetMethodSignatureByName": GetMethodSignatureByName, "GetMethodSignatureByValue": GetMethodSignatureByValue, "GetHandlerLogicMethodString": GetHandlerLogicMethodString, "GetServiceClass": func(str string) string { return strings.Split(str, ".")[0] }, "BuilderFunc": CreateBuilderFunc, })
Functions ¶
func CreateBuilderFunc ¶
func CreateBuilderFunc(table configmodels.Table) string
func CreateFileForType ¶
func CreateFileForType(fLocation FileLocation, fname string, ext FileExtension) *os.File
func CreatePathIfNotExists ¶
func CreatePathIfNotExists(path string)
func FirstToLower ¶
func GetBuilderFunc ¶
func GetBuilderFunc(table configmodels.Table) string
func GetLogicMethod ¶
func GetLogicMethod(name string) configmodels.Method
func GetMethodSignatureByValue ¶
func GetMethodSignatureByValue(name string, args datastructures.OrderedMap[string, string], returns string) string
func GetModelByName ¶
func GetModelByName(modelName string) configmodels.Model
func IsLastIndexInSlice ¶
func RunCleanupShellCommands ¶
func ZeroReturnValues ¶
Types ¶
type FileExtension ¶
type FileExtension string
const ( Go FileExtension = ".go" Yaml FileExtension = ".yaml" None FileExtension = "" )
type FileLocation ¶
type FileLocation int64
const ( Model FileLocation = iota Handler Root Cmd Wire Config API Service DockerCompose Dockerfile DB Repo )
Click to show internal directories.
Click to hide internal directories.