resolve

package
v0.0.0-...-fdde285 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidArgs = fmt.Errorf("invalid args")
View Source
var ErrInvalidType = fmt.Errorf("invalid type")
View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

func ExtractSymbol

func ExtractSymbol(universe *tinypkg.Universe, here *tinypkg.Package, s reflectshape.Shape) tinypkg.Node

Types

type Config

type Config struct {
	Log     Logger
	Verbose bool
	Debug   bool

	IgnoreMap map[string]bool
}

func DefaultConfig

func DefaultConfig() *Config

type Def

type Def struct {
	*tinypkg.Symbol
	Shape   reflectshape.Function
	Args    []Item
	Returns []Item
}

func ExtractDef

func ExtractDef(universe *tinypkg.Universe, extractor *reflectshape.Extractor, fn interface{}, ignoreMap map[string]bool) *Def

type GetSymbolFunc

type GetSymbolFunc func(*tinypkg.Package, interface{}) tinypkg.Node

type Item

type Item struct {
	Kind  Kind
	Name  string
	Shape reflectshape.Shape
}

type Kind

type Kind string
const (
	KindComponent        Kind = "component"        // pointer, function, interface
	KindData             Kind = "data"             // struct
	KindIgnored          Kind = "ignoerd"          // context.Context
	KindPrimitive        Kind = "primitve"         // string, int, ...
	KindPrimitivePointer Kind = "primitve-pointer" // *string, *int, ...
	KindUnsupported      Kind = "unsupported"      // slice, map
)

func DetectKind

func DetectKind(s reflectshape.Shape, ignoreMap map[string]bool) Kind

type Logger

type Logger interface {
	Printf(fmt string, args ...interface{})
}

type Module

type Module struct {
	Args []tinypkg.Node
	Here *tinypkg.Package
	// contains filtered or unexported fields
}

func (*Module) OnWalk

func (m *Module) OnWalk(use func(*tinypkg.Symbol) error) error

func (*Module) Shape

func (m *Module) Shape() *reflectshape.Struct

func (*Module) String

func (m *Module) String() string

func (*Module) Symbol

func (m *Module) Symbol(here *tinypkg.Package, name string) (*tinypkg.ImportedSymbol, error)

func (*Module) Type

func (m *Module) Type(name string) (*tinypkg.Func, error)

type Need

type Need struct {
	OverrideDef *Def

	*Item
	// contains filtered or unexported fields
}

type PreModule

type PreModule struct {
	Name string

	Shape *reflectshape.Struct

	Args  []reflectshape.Shape
	Funcs []reflectshape.Function
	// contains filtered or unexported fields
}

func NewPreModule

func NewPreModule(resolver *Resolver, ob reflectshape.Struct) (*PreModule, error)

func (*PreModule) NewModule

func (f *PreModule) NewModule(here *tinypkg.Package, args ...tinypkg.Node) (*Module, error)

func (*PreModule) String

func (m *PreModule) String() string

type Resolver

type Resolver struct {
	Config *Config
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver() *Resolver

func (*Resolver) Def

func (r *Resolver) Def(fn interface{}) *Def

func (*Resolver) DetectKind

func (r *Resolver) DetectKind(s reflectshape.Shape) Kind

func (*Resolver) NewPackage

func (r *Resolver) NewPackage(path, name string) *tinypkg.Package

func (*Resolver) NewPackageFromInterface

func (r *Resolver) NewPackageFromInterface(ob interface{}, name string) *tinypkg.Package

func (*Resolver) PreModule

func (r *Resolver) PreModule(ob interface{}) (*PreModule, error)

func (*Resolver) Shape

func (r *Resolver) Shape(ob interface{}) reflectshape.Shape

func (*Resolver) Symbol

func (r *Resolver) Symbol(here *tinypkg.Package, s reflectshape.Shape) tinypkg.Node

func (*Resolver) UnsafeShapeExtractor

func (r *Resolver) UnsafeShapeExtractor() *reflectshape.Extractor

type StructFromShapeInfo

type StructFromShapeInfo struct {
	GroupedByKind map[Kind][]int
}

type Tracker

type Tracker struct {
	Resolver *Resolver
	Needs    []*Need
	// contains filtered or unexported fields
}

func NewTracker

func NewTracker(resolver *Resolver) *Tracker

func (*Tracker) ExtractComponentFactoryShape

func (t *Tracker) ExtractComponentFactoryShape(x Item) reflectshape.Shape

func (*Tracker) ExtractInterface

func (t *Tracker) ExtractInterface(here *tinypkg.Package, resolver *Resolver, name string) *tinypkg.Interface

func (*Tracker) ExtractMethodName

func (t *Tracker) ExtractMethodName(rt reflect.Type, name string) string

func (*Tracker) Override

func (t *Tracker) Override(name string, providerFunc interface{}) (prev *Def, err error)

func (*Tracker) Track

func (t *Tracker) Track(def *Def)

Jump to

Keyboard shortcuts

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