genutil

package
v0.0.0-...-fee2637 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddParams

func AddParams(params *types.Tuple, isVariadic bool, customNamedType CustomType) func(*jen.Group)

func AddTypeList

func AddTypeList(typeList *types.TypeList, customNamedType CustomType) func(*jen.Group)

func AddTypeParamsList

func AddTypeParamsList(typeList *types.TypeParamList, withType bool, customNamedType CustomType) func(*jen.Group)

func FormatObjectName

func FormatObjectName(obj types.Object) string

func GetQualCode

func GetQualCode(typ types.Type, customType CustomType) *jen.Statement

func InitialIsLower

func InitialIsLower(s string) bool

func InitialIsUpper

func InitialIsUpper(s string) bool

func InitialToLower

func InitialToLower(s string) string

InitialToLower converts initial to lower.

func InitialToUpper

func InitialToUpper(s string) string

InitialToUpper converts initial to upper.

func ParamName

func ParamName(idx int, param *types.Var) string

func PkgInfoFromPath

func PkgInfoFromPath(srcDir string, mode packages.LoadMode) (*packages.Package, error)

func TypeNameCode

func TypeNameCode(typeName string) (*jen.Statement, error)

Types

type CTFunc

type CTFunc struct {
	FuncNamedType func(st jen.Statement, tt *types.Named) *jen.Statement
	FuncIsPointer func(tt *types.Pointer) bool
}

func (*CTFunc) IsPointer

func (f *CTFunc) IsPointer(tt *types.Pointer) bool

func (*CTFunc) NamedType

func (f *CTFunc) NamedType(st jen.Statement, tt *types.Named) *jen.Statement

type CustomType

type CustomType interface {
	NamedType(st jen.Statement, tt *types.Named) *jen.Statement
	IsPointer(tt *types.Pointer) bool
}

type Directive

type Directive struct {
	Name  string
	Value string
}

func (Directive) IsListValue

func (d Directive) IsListValue(value string) bool

type Directives

type Directives map[string]Directive

func ParseDoc

func ParseDoc(doc *ast.CommentGroup) ([]string, Directives)

func (Directives) IsListValue

func (d Directives) IsListValue(directive string, value string, defVal bool) bool

Jump to

Keyboard shortcuts

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