Documentation ¶
Index ¶
- type Dependency
- func (d *Dependency) AvoidCollision(ctx context.Context) *Dependency
- func (d *Dependency) Children() []*Dependency
- func (d *Dependency) FromPkg(ctx context.Context, name, path string) *Dependency
- func (d *Dependency) ImportAliased() bool
- func (d *Dependency) Name() string
- func (d *Dependency) Params() []*ast.Field
- func (d *Dependency) PkgName() string
- func (d *Dependency) PkgPath() string
- func (d *Dependency) SetChildren(ctx context.Context, children []*Dependency)
- func (d *Dependency) Type() ast.Expr
- func (d *Dependency) TypeName() string
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct {
// contains filtered or unexported fields
}
Dependency represents a dependency required by other logic. It may be a dependency of functions in the production code or a dependency of methods on interface types.
func (*Dependency) AvoidCollision ¶
func (d *Dependency) AvoidCollision(ctx context.Context) *Dependency
AvoidCollision returns a copy of this *Dependency with a new TypeName that avoids collisions with its current TypeName
func (*Dependency) Children ¶
func (d *Dependency) Children() []*Dependency
Children returns child dependencies of this dependency.
func (*Dependency) FromPkg ¶
func (d *Dependency) FromPkg(ctx context.Context, name, path string) *Dependency
FromPkg returns a copy of d but from the requested package name and path.
func (*Dependency) ImportAliased ¶
func (d *Dependency) ImportAliased() bool
ImportAliased returns whether or not this dependency's import is aliased in the local code.
func (*Dependency) Params ¶
func (d *Dependency) Params() []*ast.Field
Params returns this dependency's type parameters.
func (*Dependency) PkgName ¶
func (d *Dependency) PkgName() string
PkgName returns this dependency's package name.
func (*Dependency) PkgPath ¶
func (d *Dependency) PkgPath() string
PkgPath returns this dependency's package import path.
func (*Dependency) SetChildren ¶
func (d *Dependency) SetChildren(ctx context.Context, children []*Dependency)
SetChildren sets d's child dependencies.
func (*Dependency) Type ¶
func (d *Dependency) Type() ast.Expr
Type returns this dependency's type expression.
func (*Dependency) TypeName ¶
func (d *Dependency) TypeName() string
TypeName returns the local name of this dependency's type.
type Opt ¶
type Opt func(Dependency) Dependency
Opt is an option function for modifying a dependency.
func WithImportAlias ¶
WithImportAlias returns an Opt that sets an import alias for this dependency.
func WithTypeParams ¶
WithTypeParams returns an Opt that sets a dependency's type parameters.