Documentation ¶
Index ¶
- func AssignableTo(t1, t2 Type) bool
- func Identical(t1, t2 Type) bool
- func IsEmpty(typ Type) bool
- func QualifiedTypeName(t Type) string
- func TypeNamePrefixedByImportPath(t Type) string
- type Func
- type Iface
- type Object
- func (o *Object) Comment() string
- func (o *Object) Exported() bool
- func (o *Object) FullImportPath() string
- func (o *Object) FullPkg() string
- func (o *Object) Func() (*Func, bool)
- func (o *Object) ImportPath() string
- func (o *Object) Interface() (*Iface, bool)
- func (o *Object) IsExcluded() bool
- func (o *Object) IsMarkedAsBindable() bool
- func (o *Object) IsResolve() bool
- func (o *Object) Name() string
- func (o *Object) Pkg() string
- func (o *Object) ResolvedPkgAndFuncName() (string, string, error)
- func (o *Object) String() string
- func (o *Object) Struct() (*Struct, bool)
- func (o *Object) Type() types.Type
- type ObjectCache
- type Struct
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignableTo ¶
func QualifiedTypeName ¶
QualifiedTypeName returns a string like: 'github_com_owner_repo_pkg.TypeName' see: https://go.dev/ref/spec#Qualified_identifiers
func TypeNamePrefixedByImportPath ¶
TypeNamePrefixedByImportPath returns a string like: 'github_com_owner_repo_pkg.TypeName'
Types ¶
type Func ¶
type Func struct {
*Object
}
func (*Func) IsBindable ¶
func (*Func) IsConstructor ¶
func (*Func) MustBeResolved ¶
MustBeResolved returns true if the object has `provider:must_resolve` comment.
func (*Func) ShouldTryToResolve ¶
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
A Object is a wrapper of types.Object.
func (*Object) FullImportPath ¶
FullImportPath returns a string like: 'github_com_owner_repo_pkg "github.com/owner/repo/pkg"'
func (*Object) FullPkg ¶
FullPkg returns a string like: 'github_com_owner_repo_pkg' This string generated from o.ImportPath() by replacing '.', '/', '-' to '_'.
func (*Object) ImportPath ¶
ImportPath returns the import path of the object.
func (*Object) IsExcluded ¶
IsExcluded returns true if the object has `provider:exclude` comment.
func (*Object) IsMarkedAsBindable ¶
func (*Object) ResolvedPkgAndFuncName ¶
Resolve returns the package path and the function name to be resolved. The format of the comment must be `provider:resolve path/to/package FuncName` or `provider:resolve FuncName`. If the object has no `provider:resolve` comment, this function returns false.
type ObjectCache ¶
type ObjectCache struct {
// contains filtered or unexported fields
}
func (*ObjectCache) Add ¶
func (c *ObjectCache) Add(obj *Object)
func (*ObjectCache) All ¶
func (c *ObjectCache) All() []*Object
func (*ObjectCache) Funcs ¶
func (c *ObjectCache) Funcs() []*Func
func (*ObjectCache) Ifaces ¶
func (c *ObjectCache) Ifaces() []*Iface
func (*ObjectCache) Implementations ¶
func (c *ObjectCache) Implementations(iface *Iface) []Type