dep

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

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 New

func New(ctx context.Context, name *ast.Ident, expr ast.Expr, opts ...Opt) Dependency

New returns a new Dependency.

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) 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) Name

func (d Dependency) Name() string

Name returns d's fully qualified name.

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) 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 FromPkg

func FromPkg(name, path string) Opt

FromPkg returns an Opt that sets a dependency's package path and name.

func WithImportAlias

func WithImportAlias(alias string) Opt

WithImportAlias returns an Opt that sets an import alias for this dependency.

func WithTypeParams

func WithTypeParams(params ...*ast.Field) Opt

WithTypeParams returns an Opt that sets a dependency's type parameters.

Jump to

Keyboard shortcuts

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