package packages

import "github.com/google/cel-go/common/packages"

Package packages defines types for interpreting qualified names.

Index

Variables

var (
	// DefaultPackage has an empty package name.
	DefaultPackage = NewPackage("")
)

Functions

func ToQualifiedName

func ToQualifiedName(e *exprpb.Expr) (string, bool)

ToQualifiedName converts an expression AST into a qualified name if possible, with a boolean 'found' value that indicates if the conversion is successful.

Types

type Packager

type Packager interface {
	// Package returns the qualified package name of the packager.
	//
	// The package path may be a namespace, package, or type.
	Package() string

	// ResolveCandidateNames returns the list of possible qualified names
	// visible within the module in name resolution order.
	//
	// Name candidates are returned in order of most to least qualified in
	// order to ensure that shadowing names are encountered first.
	ResolveCandidateNames(name string) []string
}

Packager helps interpret qualified names.

func NewPackage

func NewPackage(pkg string) Packager

NewPackage creates a new Packager with the given qualified package name.

Source Files

packager.go

Version
v0.5.0
Published
May 6, 2020
Platform
js/wasm
Imports
2 packages
Last checked
1 minute ago

Tools for package owners.