scan

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerField

type ContainerField struct {
	Name     string
	TypeExpr string
	Type     types.Type

	TagRaw    string
	InjectRaw string
	Inject    InjectTag

	// IsEmbeddedCandidate is true for "_" fields without an inject tag
	// that reference another container type (embedded container).
	IsEmbeddedCandidate bool

	// IsReturns is true for fields tagged with `inject:"returns"`.
	// The field's type is used as the constructor's return type.
	IsReturns bool

	Position string
}

ContainerField represents a field within a container struct.

type ContainerSpec

type ContainerSpec struct {
	PkgPath    string
	PkgName    string
	Name       string
	Position   string
	Fields     []ContainerField
	StructType types.Type // The named type of the container struct (e.g. *types.Named for oauthCallback).
}

ContainerSpec represents a discovered container struct.

func CollectContainers

func CollectContainers(pkgs []*packages.Package) ([]ContainerSpec, error)

CollectContainers scans loaded packages and collects container structs.

type InjectTag

type InjectTag struct {
	Provider string
	Param    bool
	Returns  bool
}

InjectTag represents a parsed `inject:"..."` struct tag.

type ProviderSpec

type ProviderSpec struct {
	PkgPath      string
	PkgName      string
	Name         string
	ResultType   types.Type
	ResultString string
	ReturnError  bool
	Params       []types.Type
	Position     string
}

ProviderSpec represents a discovered provider function.

func CollectProviders

func CollectProviders(pkgs []*packages.Package) ([]ProviderSpec, error)

CollectProviders scans loaded packages and collects provider functions.

Rule: - Top-level functions only (func Foo(...)) - Exactly 1 result - Result type can be any named type, pointer to named type, or interface type - Parameters are recorded as dependency requirements

Jump to

Keyboard shortcuts

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