Documentation ¶
Index ¶
- func AppendLabels(labelstr string, labels []string) []string
- func AsImpl(value ast.Expr, pkg *packages.Package) (*types.Named, bool)
- func AsInterface(_type ast.Expr, pkg *packages.Package) (*types.Named, bool)
- func CamelCase(text string) string
- func Directives(comments ast.CommentMap, pkg *packages.Package) []string
- func IocGen(typ types.Type)
- func IsError(obj types.Type) bool
- func IsErrorVar(v *types.Var) bool
- func IsInterfaceKind(k TypeKind) bool
- func IsStructPointerKind(k TypeKind) bool
- func Load(path string) *packages.Package
- func SearchDirectives(flagSet *flag.FlagSet, directives []string, patterns []string, name string, ...) string
- func TypeName(typ types.Type) string
- func TypePkg(typ types.Type) *types.Package
- type Directive
- type Func
- func (f *Func) Exported() bool
- func (f *Func) FullName() string
- func (f *Func) Id() string
- func (f *Func) IsValid() bool
- func (f *Func) Kind() string
- func (f *Func) Labels() string
- func (f *Func) Name() string
- func (f *Func) Param(i int) (*types.Var, error)
- func (f *Func) ParamPvd(param string) string
- func (f *Func) ParamType(i int) (types.Type, error)
- func (f *Func) Params() *types.Tuple
- func (f *Func) Parent() *types.Scope
- func (f *Func) Pkg() *types.Package
- func (f *Func) PvdName() string
- func (f *Func) Recv() *types.Var
- func (f *Func) RecvTypeParams() *types.TypeParamList
- func (f *Func) Result(i int) (*types.Var, bool)
- func (f *Func) ResultType(i int) (types.Type, bool)
- func (f *Func) Results() *types.Tuple
- func (f *Func) ReturnError() bool
- func (f *Func) SetDirectives(directives []string)
- func (f *Func) SignatureString() string
- func (f *Func) String() string
- func (f *Func) TypeParams() *types.TypeParamList
- func (f *Func) Underlying() types.Type
- func (f *Func) Variadic() bool
- type ImplementStmt
- func (s *ImplementStmt) IfaceName() string
- func (s *ImplementStmt) IfacePkg() *types.Package
- func (s *ImplementStmt) ImplName() string
- func (s *ImplementStmt) ImplPkg() *types.Package
- func (s *ImplementStmt) ImplType() types.Type
- func (s *ImplementStmt) IsPointerImpl() bool
- func (s *ImplementStmt) Labels() string
- func (s *ImplementStmt) SetDirectives(directives []string)
- func (s *ImplementStmt) String() string
- type Interface
- func (t *Interface) Complete() *types.Interface
- func (t *Interface) ComponentName() string
- func (t *Interface) Directives() []string
- func (t *Interface) EmbeddedType(i int) types.Type
- func (t *Interface) Empty() bool
- func (t *Interface) ExplicitMethod(i int) *types.Func
- func (t *Interface) Exported() bool
- func (t *Interface) IsComparable() bool
- func (t *Interface) IsImplicit() bool
- func (t *Interface) IsMethodSet() bool
- func (t *Interface) Method(i int) *types.Func
- func (t *Interface) Name() string
- func (t *Interface) NumEmbeddeds() int
- func (t *Interface) NumExplicitMethods() int
- func (t *Interface) NumMethods() int
- func (t *Interface) Parent() *types.Scope
- func (t *Interface) Pkg() *types.Package
- func (t *Interface) SetDirectives(directives []string)
- func (t *Interface) String() string
- func (t *Interface) Type() types.Type
- func (t *Interface) Underlying() types.Type
- type Labels
- type ObjectKind
- type Struct
- func (s *Struct) Autowire() bool
- func (s *Struct) ComponentName() string
- func (s *Struct) Exported() bool
- func (s *Struct) Field(i int) *types.Var
- func (s *Struct) Fields() iter.Seq2[int, *Var]
- func (s *Struct) IsComponent() bool
- func (s *Struct) Method(i int) *types.Func
- func (s *Struct) Name() string
- func (s *Struct) NumFields() int
- func (s *Struct) NumMethods() int
- func (s *Struct) Origin() *types.Named
- func (s *Struct) ParentScope() *types.Scope
- func (s *Struct) Pkg() *types.Package
- func (s *Struct) SetDirectives(directives []string)
- func (s *Struct) String() string
- func (s *Struct) Tag(i int) reflect.StructTag
- func (s *Struct) Type() types.Type
- func (s *Struct) TypeArgs() *types.TypeList
- func (s *Struct) TypeParams() *types.TypeParamList
- type TypeKind
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendLabels ¶
func Directives ¶
func Directives(comments ast.CommentMap, pkg *packages.Package) []string
func IocGen ¶
IocGen create an init function for type T.
it automatically search the dependencies tree, and fill the dependencies.
func IsErrorVar ¶
func IsInterfaceKind ¶
func IsStructPointerKind ¶
func SearchDirectives ¶
Types ¶
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
func (*Func) RecvTypeParams ¶
func (f *Func) RecvTypeParams() *types.TypeParamList
func (*Func) ReturnError ¶
func (*Func) SetDirectives ¶
func (*Func) SignatureString ¶
func (*Func) TypeParams ¶
func (f *Func) TypeParams() *types.TypeParamList
func (*Func) Underlying ¶
type ImplementStmt ¶
type ImplementStmt struct {
// contains filtered or unexported fields
}
ImplementStmt denote that user explicitly specify type x implements interface y
it is direvied from ast with blow convention boilerplate.
- var _ liu.Namer = (*guan.Guan)(nil)
- func (g *Guan2) Implements() liu.Namer { return g }
func NewImplementStmt ¶
func NewImplementStmtSlice ¶
func NewImplementStmtSlice(fn *Func, pkg *packages.Package) ([]*ImplementStmt, bool)
func (*ImplementStmt) IfaceName ¶
func (s *ImplementStmt) IfaceName() string
func (*ImplementStmt) IfacePkg ¶
func (s *ImplementStmt) IfacePkg() *types.Package
func (*ImplementStmt) ImplName ¶
func (s *ImplementStmt) ImplName() string
func (*ImplementStmt) ImplPkg ¶
func (s *ImplementStmt) ImplPkg() *types.Package
func (*ImplementStmt) ImplType ¶
func (s *ImplementStmt) ImplType() types.Type
func (*ImplementStmt) IsPointerImpl ¶
func (s *ImplementStmt) IsPointerImpl() bool
func (*ImplementStmt) Labels ¶
func (s *ImplementStmt) Labels() string
func (*ImplementStmt) SetDirectives ¶
func (s *ImplementStmt) SetDirectives(directives []string)
func (*ImplementStmt) String ¶
func (s *ImplementStmt) String() string
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
func (*Interface) ComponentName ¶
ComponentName return name of the component, specified by --name. default to camelCased TypeName eg: go:ioc component --name book
func (*Interface) Directives ¶
func (*Interface) IsComparable ¶
func (*Interface) IsImplicit ¶
func (*Interface) IsMethodSet ¶
func (*Interface) NumEmbeddeds ¶
func (*Interface) NumExplicitMethods ¶
func (*Interface) NumMethods ¶
func (*Interface) SetDirectives ¶
func (*Interface) Underlying ¶
type ObjectKind ¶
type ObjectKind int
const ( KindStruct ObjectKind = iota KindInterface KindFunc KindVar KindOther )
func Kind ¶
func Kind(obj types.Object) ObjectKind
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
func LoadStructs ¶
func (*Struct) ComponentName ¶
ComponentName return name of the component, specified by --name. default to camelCased TypeName eg: go:ioc component --name book
func (*Struct) IsComponent ¶
func (*Struct) NumMethods ¶
func (*Struct) ParentScope ¶
func (*Struct) SetDirectives ¶
func (*Struct) TypeParams ¶
func (s *Struct) TypeParams() *types.TypeParamList
type TypeKind ¶
type TypeKind int
const ( TypeKindStruct TypeKind = 1 << iota TypeKindPointer TypeKindInterface TypeKindFunc TypeKindBasic TypeKindNestedPointer TypeKindOther // TypeKindStructPointer = (TypeKindStruct | TypeKindPointer) )
func TypeKindOf ¶
type Var ¶
type Var struct {
// contains filtered or unexported fields
}
func (*Var) Directives ¶
func (*Var) SetDirectives ¶
Click to show internal directories.
Click to hide internal directories.