pkgsite: golang.org/x/pkgsite/internal/complete Index | Files

package complete

import "golang.org/x/pkgsite/internal/complete"

Package complete defines a Completion type that is used in auto-completion, along with Encode and Decode methods that can be used for storing this type in redis.

Index

Package Files

completion.go

Constants

const (
    KeyPrefix    = "completions"
    PopularKey   = KeyPrefix + "Popular"
    RemainingKey = KeyPrefix + "Rest"
)

Redis keys for completion sorted sets ("indexes"). They are in this package so that they can be accessed by both worker and frontend.

type Completion Uses

type Completion struct {
    // Suffix is the path suffix that matched the compltion input, e.g. a query
    // for "error" would match the suffix "errors" of "github.com/pkg/errors".
    Suffix string
    // ModulePath is the module path of the completion match. We may support
    // matches of the same path in different modules.
    ModulePath string
    // Version is the module version of the completion entry.
    Version string
    // PackagePath is the full import path.
    PackagePath string
    // Importers is the number of importers of this package. It is used for
    // sorting completion results.
    Importers int
}

Completion holds package data from an auto-completion match.

func Decode Uses

func Decode(entry string) (_ *Completion, err error)

Decode parses a completion entry from the completions index.

func PathCompletions Uses

func PathCompletions(partial Completion) []*Completion

PathCompletions generates completion entries for all possible suffixes of partial.PackagePath.

func (Completion) Encode Uses

func (c Completion) Encode() string

Encode string-encodes a completion for storing in the completion index.

Package complete imports 4 packages (graph) and is imported by 4 packages. Updated 2020-10-28. Refresh now. Tools for package owners.