Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Derivation ¶
type Derivation interface {
// contains filtered or unexported methods
}
Derivation is a type that represents a derivation of a resolver.
type FuncDecl ¶
type FuncDecl interface { FuncName() string FuncBody() string Imports() []string Pkg() string FuncReturn() string // contains filtered or unexported methods }
A FuncDecl is a type that represents a function of a resolver.
type PrivateFuncDecl ¶
type PrivateFuncDecl struct {
// contains filtered or unexported fields
}
A PrivateFuncDecl is a type that represents a private function of a resolver.
func (*PrivateFuncDecl) FuncBody ¶
func (p *PrivateFuncDecl) FuncBody() string
func (*PrivateFuncDecl) FuncName ¶
func (i *PrivateFuncDecl) FuncName() string
func (*PrivateFuncDecl) FuncReturn ¶
func (i *PrivateFuncDecl) FuncReturn() string
func (*PrivateFuncDecl) Imports ¶
func (i *PrivateFuncDecl) Imports() []string
func (*PrivateFuncDecl) Pkg ¶
func (i *PrivateFuncDecl) Pkg() string
func (*PrivateFuncDecl) ReturnType ¶
func (i *PrivateFuncDecl) ReturnType() parser.Type
type PublicFuncDecl ¶
type PublicFuncDecl struct {
// contains filtered or unexported fields
}
A PublicFuncDecl is a type that represents a public function of a resolver.
func (*PublicFuncDecl) FuncBody ¶
func (p *PublicFuncDecl) FuncBody() string
func (*PublicFuncDecl) FuncName ¶
func (p *PublicFuncDecl) FuncName() string
func (*PublicFuncDecl) FuncReturn ¶
func (p *PublicFuncDecl) FuncReturn() string
func (*PublicFuncDecl) Imports ¶
func (p *PublicFuncDecl) Imports() []string
func (*PublicFuncDecl) Pkg ¶
func (p *PublicFuncDecl) Pkg() string
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func (*Resolver) AddFunc ¶
func (w *Resolver) AddFunc(fn *PrivateFuncDecl)
func (*Resolver) Resolve ¶
Resolve feature searches for constructors within the ObjectCache that can resolve dependencies, and returns the resolved results as function declarations (FuncDecl). Here, a 'constructor' refers to a function that is not a method, has one or more arguments, and returns a single value.
'Resolution' means generating the necessary arguments for a constructor and making the function executable. 'Resolved result' refers to the declarations of the functions required to perform such processing.
The resolution process occurs in the following steps:
1. For all interfaces in the ObjectCache, determine a single constructor that will be bound to each. 2. Seek derivations for these interfaces. This involves checking if constructors bound to interface types can be derived using other methods. 3. For all functions in the ObjectCache, determine their resolution results.
Through this process, we can provide a simple and user-friendly interface with resolved dependencies.