utils

package
v0.0.0-...-0bfb5ad Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddImport

func AddImport(file, alias, impt string) (string, error)

func AddImportForContent

func AddImportForContent(fileContent string, alias, impt string) (string, error)

func BaseName

func BaseName(include, subFixToTrim string) string

BaseName get base name for path. ex: "github.com/p.s.m" => "p.s.m"

func BaseNameAndTrim

func BaseNameAndTrim(include string) string

func CodegenCacheHome

func CodegenCacheHome() string

func CodegenConfigHome

func CodegenConfigHome() string

func CodegenHome

func CodegenHome() string

func CodegenTemplateHome

func CodegenTemplateHome() string

func CreateHzFile

func CreateHzFile(outputDir string) error

func GetAnnotation

func GetAnnotation(input parser.Annotations, target string) []string

func GetAnnotations

func GetAnnotations(input parser.Annotations, targets map[string]string) map[string][]string

func GetFirstKV

func GetFirstKV(m map[string][]string) (string, []string)

func GetHandlerPackageUniqueName

func GetHandlerPackageUniqueName(name string) (string, error)

func GetMiddlewareUniqueName

func GetMiddlewareUniqueName(name string) (string, error)

GetMiddlewareUniqueName can get a non-repeating variable name for middleware name

func GetPackageUniqueName

func GetPackageUniqueName(name string) (string, error)

GetPackageUniqueName can get a non-repeating variable name for package alias

func GetProtoFiles

func GetProtoFiles(paths []string) []string

func GetThriftFiles

func GetThriftFiles(paths []string) []string

func GetYamlFiles

func GetYamlFiles(paths []string) []string

func ImportToPath

func ImportToPath(path, subFix string) string

func ImportToPathAndConcat

func ImportToPathAndConcat(path, subFix string) string

func IsHzNew

func IsHzNew(outputDir string) bool

func IsWindows

func IsWindows() bool

func PathToImport

func PathToImport(path, subFix string) string

func PrintlnImports

func PrintlnImports(imports []Import) string

func SplitGoTags

func SplitGoTags(input string) []string

func SplitPackage

func SplitPackage(pkg, subFixToTrim string) string

func SplitPackageName

func SplitPackageName(pkg, subFixToTrim string) string

func SubDir

func SubDir(root, subPkg string) string

func SubPackage

func SubPackage(mod, dir string) string

func SubPackageDir

func SubPackageDir(path string) string

func ToGoFuncName

func ToGoFuncName(s string) string

ToGoFuncName converts a string to a function naming style for go

func ToVarName

func ToVarName(paths []string) string

Types

type Import

type Import struct {
	Alias string
	Path  string
}

func SortImports

func SortImports(imps map[string]string, localPrefix string) (ret []Import)

func (Import) PackageName

func (i Import) PackageName() string

type ThriftIDLCache

type ThriftIDLCache struct {
	// contains filtered or unexported fields
}

func NewThriftIDLCache

func NewThriftIDLCache(cu *golang.CodeUtils) *ThriftIDLCache

func (*ThriftIDLCache) AddFile

func (c *ThriftIDLCache) AddFile(filename string) (*golang.Scope, error)

func (*ThriftIDLCache) GetScope

func (c *ThriftIDLCache) GetScope(path string) (*golang.Scope, bool)

func (*ThriftIDLCache) GetScopeByAst

func (c *ThriftIDLCache) GetScopeByAst(ast *parser.Thrift) (*golang.Scope, bool)

func (*ThriftIDLCache) GetWaitProcessScopes

func (c *ThriftIDLCache) GetWaitProcessScopes() []*golang.Scope

Jump to

Keyboard shortcuts

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