utils

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFileWithData added in v0.1.5

func CreateFileWithData(filePath, data string)

CreateFileWithData creates file at given directory with passed data

func GetAppName

func GetAppName(moduleName string) string

GetAppName name from the moduleName

func GetArgs added in v0.1.5

func GetArgs(prefix string, args []string) []string

GetArgs reads arg from passed args as per the specified name for example `ReadArgs("-c=",[]string{"up","-c='go run main.go'","seed"})“ will return []string{"go", "run", "main.go"}

func ListContains added in v0.0.5

func ListContains(value string, list []string) bool

ListContains check list has given value or not

func ReadAndCreateFile

func ReadAndCreateFile(source, appName, moduleName string)

Will be used in the future

func ReadArgs added in v0.1.5

func ReadArgs(prefix string, args []string) string

ReadArgs reads arg from passed args as per the specified name for example `ReadArgs("-p=",[]string{"up","-p='db/migrations'","seed"})“ will return `db/migrations`

func RenderMain

func RenderMain(tmpl, fileName, packageName, module_name string)

RenderMain creates main.go

func RenderWriteToFile

func RenderWriteToFile(tmpl string, func_name string, file_name string)

RenderWriteToFile creates src files

func RenderWriteToFileModule

func RenderWriteToFileModule(tmpl, fileName, resName, module_name, packageName string)

RenderWriteToFileModule creates src module files

func UserPrompt added in v0.1.5

func UserPrompt(message string) string

UserPrompt accepts user input from the cli

Types

type ArgsResult added in v0.1.5

type ArgsResult struct {
	App  string
	Args []string
}

type ArgsStruct added in v0.1.5

type ArgsStruct struct {
	Prefix string
	Args   []string
	Result ArgsResult
}

ArgsResult holds niom start data

func (*ArgsStruct) AppAndArgs added in v0.1.5

func (a *ArgsStruct) AppAndArgs()

AppAndArgs sets ArgsResult for example `ArgsStruct{Prefix: "-c=",Args : []string{"up","-c='go run main.go'",}“ will set ArgsResult{App: 'go' Args: []string{ "run", "main.go"}}

type TemplateArgs

type TemplateArgs struct {
	Name          string
	NameLowerCase string
	ModuleName    string
	PackageName   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL