typeutil

package
v0.0.0-...-9c8aaae Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllImported

func AllImported(pkg *loader.PackageInfo) []*types.Package

func FmtImports

func FmtImports(pkgs []*types.Package, current *types.Package) string

func FuncToParams

func FuncToParams(s *types.Func) []*types.Var

func FuncToResults

func FuncToResults(s *types.Func) []*types.Var

func IsContainedInPackage

func IsContainedInPackage(pkg *types.Package, typ types.Type) bool

func ListSetters

func ListSetters(typ *types.Named, onlyExported bool) []*types.Func

func ObjectToFields

func ObjectToFields(s types.Object) []*types.Var

func ObjectToTags

func ObjectToTags(s types.Object) []string

func SamePackage

func SamePackage(a *types.Package, b *types.Package) bool

func SearchConstructor

func SearchConstructor(typ *types.Named) *types.Func

func SearchField

func SearchField(typ types.Type, paramName string, onlyExported bool) *types.Var

func SearchGetValueStrAndResultType

func SearchGetValueStrAndResultType(typ types.Type, paramName string, onlyExported bool) (string, types.Type)

func SearchGetter

func SearchGetter(typ *types.Named, paramName string, onlyExported bool) *types.Func

func SearchPackage

func SearchPackage(pkg *loader.PackageInfo, name string) *types.Package

func SearchSetter

func SearchSetter(typ *types.Named, paramName string, onlyExported bool) *types.Func

func StructToFields

func StructToFields(s *types.Struct) []*types.Var

func StructToTags

func StructToTags(s *types.Struct) []string

func TypeToEnumValues

func TypeToEnumValues(t types.Type) []*types.Const

func TypeToFields

func TypeToFields(s types.Type) []*types.Var

func TypeToPackage

func TypeToPackage(typ types.Type) *types.Package

func TypeToTags

func TypeToTags(s types.Type) []string

Types

type Printer

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

genconstructor

func NewPrinter

func NewPrinter(
	dstPackage *types.Package,
) Printer

func (Printer) FillConstructor

func (p Printer) FillConstructor(
	constructor *types.Func,
	sourceName string,
	sourceType types.Type,
	nestNum int,
) (string, error)

func (Printer) PrintAssignToSetters

func (p Printer) PrintAssignToSetters(
	sourceName string,
	sourceType types.Type,
	targetName string,
	targetType *types.Named,
	nestNum int,
) (string, error)

func (Printer) PrintConverterWitoutErrorCheck

func (p Printer) PrintConverterWitoutErrorCheck(
	sourceName string,
	sourceType types.Type,
	targetType types.Type,
) (string, error)

func (Printer) PrintGetValue

func (p Printer) PrintGetValue(
	parentName string,
	parentType types.Type,
	targetName string,
) (string, error)

func (Printer) PrintRelativeConst

func (p Printer) PrintRelativeConst(c *types.Const) string

func (Printer) PrintRelativeFuncName

func (p Printer) PrintRelativeFuncName(f *types.Func) string

func (Printer) PrintRelativeObject

func (p Printer) PrintRelativeObject(t types.Object) string

func (Printer) PrintRelativeType

func (p Printer) PrintRelativeType(t types.Type) string

func (*Printer) SetPkgPathToName

func (m *Printer) SetPkgPathToName(s map[string]string)

func (Printer) ToStringConverter

func (p Printer) ToStringConverter(
	sourceName string,
	sourceType types.Type,
) (string, error)

Jump to

Keyboard shortcuts

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