fragmentutils

package module
v0.1.12-alpha5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

README

fragment-utils

Fragment编写工具包

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFieldToStruct added in v0.1.9

func AddFieldToStruct(filePath string, structName string, fieldName string, fieldTypeAndTags string) (string, error)

func AddImportPackage added in v0.1.11

func AddImportPackage(filePath string, packagePath string) (string, error)

func AddLineToEndOfBlock added in v0.1.11

func AddLineToEndOfBlock(filePath string, blockStart string, blockEnd string, addLine string, addLineExistKey string) (string, error)

func AddRepositorySetFieldMethod

func AddRepositorySetFieldMethod(repositoryFilePath string, method string, toCheck string) error

func CheckError

func CheckError(err error, replaceError func(originErr error) error)

func CopyFile

func CopyFile(srcFile string, dstFile string) error

func DeleteContentWithPrefixAndSuffix added in v0.1.7

func DeleteContentWithPrefixAndSuffix(s string, prefix string, suffix string) (string, error)

func FindAPISwagger added in v0.1.12

func FindAPISwagger(filePath string, functionName string) (string, error)

func FindContentBetweenStartAndEnd added in v0.1.7

func FindContentBetweenStartAndEnd(s string, startStr string, endStr string) (string, error)

func FindContentWithStartAndEnd added in v0.1.7

func FindContentWithStartAndEnd(s string, startStr string, endStr string) (string, error)

func FindMethod added in v0.1.12

func FindMethod(filePath string, receiver string, methodParamName string, methodName string) (string, error)

func FindServiceName added in v0.1.5

func FindServiceName(projectAbsDir string) (string, error)

func FindStruct added in v0.1.6

func FindStruct(filePath string, structName string) (string, error)

func FindUrlPrefix added in v0.1.4

func FindUrlPrefix(projectAbsDir string) (string, error)

func GetDirFiles

func GetDirFiles(dir string) ([]string, error)

func GetRepositoryFilePath

func GetRepositoryFilePath(projectAbsDir string, entityName string) string

func GetRootPackageName

func GetRootPackageName(projectAbsDir string) (string, error)

func HasBlank

func HasBlank(str ...string) bool

func IDDTOJSONCase

func IDDTOJSONCase(s string) string

func IDParamsCase added in v0.1.11

func IDParamsCase(s string) string

func LeftLower

func LeftLower(s string) string

func LeftUpper

func LeftUpper(s string) string

func LoadYAMLFile

func LoadYAMLFile(yamlFilePath string, conf interface{}) error

func ParseTemplate

func ParseTemplate(templateName string, templateStr string, conf interface{}) (string, error)

func ParseTemplateFile

func ParseTemplateFile(inputFilePath string, conf interface{}) (string, error)

func PathExists

func PathExists(path string) bool

func Plural

func Plural(s string) string

func RenameStruct added in v0.1.11

func RenameStruct(filePath string, oldStructName string, newStructName string, removeTags bool) (string, error)

func RunCommand

func RunCommand(name string, args ...string) error

func SnakeCase

func SnakeCase(s string) string

func StringBetween

func StringBetween(content string, startStr string, endStr string) (startIndex int, num int,
	newContent string, betweenContent string)

func UpperShort added in v0.1.11

func UpperShort(s string) string

Types

type StructField added in v0.1.11

type StructField struct {
	Name string
	Type string
	Tags string
}

func FindStructFields added in v0.1.11

func FindStructFields(filePath string, structName string) ([]StructField, error)

type SwaggerParams added in v0.1.10

type SwaggerParams struct {
	Name       string
	Type       string
	ParamsType string
}

func FindAPISwaggerParams added in v0.1.10

func FindAPISwaggerParams(filePath string, functionName string) ([]SwaggerParams, error)

Jump to

Keyboard shortcuts

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