utils

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppTemplates embed.FS
View Source
var FuncMap = template.FuncMap{
	"CamelCase":  CamelCase,
	"PascalCase": PascalCase,
	"SnakeCase":  SnakeCase,
	"UpperCase":  UpperCase,
	"LowerCase":  LowerCase,
	"SpaceCase":  SpaceCase,
	"StartWith":  StartWith,
}

Functions

func CamelCase

func CamelCase(name string) string

CamelCase is

func CopyPasteFolder added in v0.0.2

func CopyPasteFolder(destFolder, sourceFolder string) error

func CreateEverythingExactly

func CreateEverythingExactly(rootToSkip, pathUnder string, fileRenamer map[string]string, data any, efs embed.FS) error

func CreateEverythingExactly2 added in v0.0.2

func CreateEverythingExactly2(rootToSkip, pathUnder string, fileRenamer map[string]string, data any) error

func CreateFolderIfNotExist

func CreateFolderIfNotExist(folderPath string) (bool, error)

CreateFolderIfNotExist ...

func CreateGogenConfig added in v0.0.2

func CreateGogenConfig(err error, domainName string) error

func GetDefaultDomain2 added in v0.0.2

func GetDefaultDomain2() string

func GetExecutableName

func GetExecutableName() string

func GetGogenConfig added in v0.0.2

func GetGogenConfig() model.GogenConfig

func GetPackageName

func GetPackageName(rootFolderName string) string

GetPackageName ...

func GetPackagePath

func GetPackagePath() string

func HasOneOfThisPrefix

func HasOneOfThisPrefix(s string, str ...string) bool

HasOneOfThisPrefix ...

func InjectCodeAtTheEndOfFile

func InjectCodeAtTheEndOfFile(filename, templateCode string) ([]byte, error)

func InjectToCode added in v0.0.22

func InjectToCode(existingFile, injectedCode string) ([]byte, error)

func InjectToErrorEnum

func InjectToErrorEnum(fset *token.FileSet, filepath string, errorName, separator string)

func InjectToMain

func InjectToMain(fset *token.FileSet, applicationName string)

func IsExist

func IsExist(fset *token.FileSet, rootFolderName string, foundExactType func(file *ast.File, ts *ast.TypeSpec) bool) bool

func IsFileExist

func IsFileExist(filepath string) bool

func LowerCase

func LowerCase(name string) string

LowerCase is

func MustJSON

func MustJSON(obj any) string

MustJSON is converter from any to string Warning! this function will always assume the conversion is success if you are not sure the conversion is always succeed then use ToJSON

func NewOutportMethodImpl

func NewOutportMethodImpl(structName, gatewayRootFolderName string) (map[string]int, error)

func PascalCase

func PascalCase(name string) string

PascalCase is

func PrintTemplate

func PrintTemplate(templateString string, x any) (string, error)

func Reformat

func Reformat(goFilename string, bytes []byte) error

func SnakeCase

func SnakeCase(str string) string

SnakeCase is

func SpaceCase

func SpaceCase(str string) string

SpaceCase is

func StartWith

func StartWith(str, prefix string) bool

StartWith is

func UpperCase

func UpperCase(name string) string

UpperCase is

func WriteFile

func WriteFile(templateData, outputFilePath string, obj any) error

WriteFile ...

func WriteFileIfNotExist

func WriteFileIfNotExist(templateFile, outputFilePath string, obj any) (bool, error)

WriteFileIfNotExist ...

Types

type FileAndFolders

type FileAndFolders struct {
	Folders map[string]int
	Files   []string
}

type FileAndFolders2 added in v0.0.2

type FileAndFolders2 struct {
	Folders map[string]int
	Files   []string
}

type OutportMethods

type OutportMethods []*method

OutportMethods ...

func NewOutportMethods

func NewOutportMethods(domainName, usecaseName string) (OutportMethods, error)

NewOutportMethods read the Outport interface and collect all method on it

type TypeHandler

type TypeHandler struct {
	PrefixExpression string //
}

TypeHandler ...

func (TypeHandler) Start

func (r TypeHandler) Start(expr ast.Expr) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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