typeindex

package
v0.0.0-...-bc5a6c4 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index stores types and enables them to be searched.

func NewIndex

func NewIndex() *Index

NewIndex creates a new empty index.

func NewIndexFromBytes

func NewIndexFromBytes(r io.Reader) (*Index, error)

NewIndexFromBytes decodes the reader's data into an index.

func (*Index) InsertFunction

func (idx *Index) InsertFunction(location extract.Location, fnc types.Function)

InsertFunction adds a function to the index.

func (*Index) InsertInterface

func (idx *Index) InsertInterface(location extract.Location, ifc types.Interface)

InsertInterface adds an interface to the index.

func (*Index) InsertValue

func (idx *Index) InsertValue(location extract.Location, val types.Value)

InsertValue adds a value to the index.

func (*Index) Packages

func (idx *Index) Packages() [][]string

Packages returns a list of all packages in the index. The first item will contain the standard library packages. Subsequent hosted packages are grouped by the host domain.

func (*Index) Search

func (idx *Index) Search(query string) ([]*Result, error)

Search returns a interfaces that match the query in deacreasing order of confidence.

func (*Index) ToBytes

func (idx *Index) ToBytes(w io.Writer) error

ToBytes encodes the index to bytes and writes them to the writer.

type Result

type Result struct {
	Confidence float64
	Name       string
	Location   extract.Location
	Value      types.Type
}

Result represents a matched value from the index.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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