util

package
v0.0.0-...-392fa8f Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Package = "package"
	True    = "true"
	False   = "false"
)

Variables

This section is empty.

Functions

func AstParseDir

func AstParseDir(dir string) (files []*ast.File, err error)

func BoilerplatePath

func BoilerplatePath() string

BoilerplatePath returns the path to the boilerplate file in code-generator, or "" if the default boilerplate.go.txt file cannot be located.

func CheckTag

func CheckTag(tag string, comments []string, require ...string) bool

func CurrentPackage

func CurrentPackage() string

CurrentPackage returns the go package of the current directory, or "" if it cannot be derived from the GOPATH.

func Exist

func Exist(list []string, want string) bool

func FindTypeNames

func FindTypeNames(files []*ast.File) (m map[string]string)

func GenName

func GenName(prefix, suffix string) func(name string) string

func GetTagBoolStatus

func GetTagBoolStatus(tag string, comments []string) (set bool, enabled bool)

func GetTagValueStatus

func GetTagValueStatus(tag string, comments []string) (bool, string)

func GetTagValues

func GetTagValues(tag string, comments []string) []string

func GetTagValuesStatus

func GetTagValuesStatus(tag string, comments []string) (bool, []string)

func IsLower

func IsLower(s string) bool

func IsReference

func IsReference(t *types.Type) bool

IsReference return true for pointer, maps, slices and aliases of those.

func ReContextOrder

func ReContextOrder(c *generator.Context, canonicalOrderName string)

ReContextOrder 重新进行排除

func UnderlyingType

func UnderlyingType(t *types.Type) *types.Type

func Vendorless

func Vendorless(p string) string

Vendorless trims vendor prefix from a package path to make it canonical

Types

type MethodGenerate

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

func NewMethodGenerate

func NewMethodGenerate(fn func(name string) string, handler ...func(string) string) MethodGenerate

func (*MethodGenerate) AddExistName

func (m *MethodGenerate) AddExistName(name string) (bool, int)

func (*MethodGenerate) AddExistNames

func (m *MethodGenerate) AddExistNames(name ...string) *MethodGenerate

func (*MethodGenerate) ExistName

func (m *MethodGenerate) ExistName(name string) bool

func (*MethodGenerate) GenName

func (m *MethodGenerate) GenName(name string) string

type MethodSet

type MethodSet map[string][]types.Member // key: method name, value: types.Member

func NewMethodSet

func NewMethodSet() MethodSet

func (MethodSet) AddMethod

func (m MethodSet) AddMethod(prefix, method string, member types.Member)

func (MethodSet) AddMethods

func (m MethodSet) AddMethods(prefix string, methods []string, member types.Member)

type PackageType

type PackageType struct {
	Name  string            // pkg name
	Types map[string]string // key: type's name value: type
}

func (PackageType) GetType

func (p PackageType) GetType(name string) string

func (PackageType) IsExternalType

func (p PackageType) IsExternalType(name string) bool

type PackageTypes

type PackageTypes []*PackageType

func NewPackageTypes

func NewPackageTypes(build *parser.Builder) (ret PackageTypes)

func (PackageTypes) Find

func (list PackageTypes) Find(pkg string) *PackageType

func (PackageTypes) IsExternalType

func (list PackageTypes) IsExternalType(pkg, name string) bool

Jump to

Keyboard shortcuts

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