aahframe.work: aahframe.work/ainsp Index | Files

package ainsp

import "aahframe.work/ainsp"

Package ainsp is a Go ast library for aah framework, it does inspect and discovers the Go `struct` which embeds particular type `struct`.

For e.g.: `aahframework.org/{aah.Context, ws.Context}`, etc.

Index

Package Files

ainsp.go package.go program.go target.go util.go

func FindFieldIndexes Uses

func FindFieldIndexes(targetTyp reflect.Type, searchTyp reflect.Type) [][]int

FindFieldIndexes method does breadth-first search on struct anonymous field to find given type `struct` discover index positions.

For e.g.: `aah.Context`, `ws.Context`, etc.

type Method Uses

type Method struct {
    Name       string
    Parameters []*Parameter
}

Method holds single method information of target.

type Parameter Uses

type Parameter struct {
    Name string
    Type reflect.Type
    Kind reflect.Kind
}

Parameter holds parameter information of method.

type Program Uses

type Program struct {
    Path              string
    Packages          []*packageInfo
    RegisteredActions map[string]map[string]uint8
}

Program holds all details loaded from the Go source code for given Import Path.

func Inspect Uses

func Inspect(dir, importPath string, excludes ess.Excludes, registeredActions map[string]map[string]uint8) (*Program, []error)

Inspect method processes the Go source code for the given directory and its sub-directories.

func (*Program) CreateImportPaths Uses

func (prg *Program) CreateImportPaths(types []*typeInfo, importPaths map[string]string) map[string]string

CreateImportPaths method returns unique package alias with import path.

func (*Program) FindTypeByEmbeddedType Uses

func (prg *Program) FindTypeByEmbeddedType(qualifiedTypeName string) []*typeInfo

FindTypeByEmbeddedType method returns all the typeInfo that has directly or indirectly embedded by given type name. Type name must be fully qualified type name. E.g.: aahframework.org/aah.Controller

type Target Uses

type Target struct {
    Name            string
    FqName          string
    NoSuffixName    string
    Namespace       string
    Type            reflect.Type
    Methods         map[string]*Method
    EmbeddedIndexes [][]int
}

Target struct holds info about targeted controller, websocket, etc.

func (*Target) Lookup Uses

func (t *Target) Lookup(methodName string) *Method

Lookup method returns method info for given name (case insensitive) otherwise nil.

type TargetRegistry Uses

type TargetRegistry struct {
    Registry   map[string]*Target
    SearchType reflect.Type
}

TargetRegistry struct holds registered information and provides lookup. Such as aah application controllers, websockets, etc.

func (*TargetRegistry) Add Uses

func (tr *TargetRegistry) Add(t interface{}, methods []*Method)

Add method adds given target struct and its methods after processing.

func (*TargetRegistry) Lookup Uses

func (tr *TargetRegistry) Lookup(fqName string) *Target

Lookup method returns `Target` info from registry for given `fqName` (fully qualified name) otherwise nil.

It does exact match or exact suffix match.

Package ainsp imports 14 packages (graph) and is imported by 7 packages. Updated 2019-05-16. Refresh now. Tools for package owners.