CINXE.COM
interpreter package - github.com/google/cel-go/interpreter - Go Packages
<!DOCTYPE html> <html lang="en" data-layout="responsive" data-local=""> <head> <script> window.addEventListener('error', window.__err=function f(e){f.p=f.p||[];f.p.push(e)}); </script> <script> (function() { const theme = document.cookie.match(/prefers-color-scheme=(light|dark|auto)/)?.[1] if (theme) { document.querySelector('html').setAttribute('data-theme', theme); } }()) </script> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="Description" content="Package interpreter provides functions to evaluate parsed expressions with the option to augment the evaluation with inputs and functions supplied at evaluation time."> <meta class="js-gtmID" data-gtmid="GTM-W8MVQXG"> <link rel="shortcut icon" href="/static/shared/icon/favicon.ico"> <link rel="canonical" href="https://pkg.go.dev/github.com/google/cel-go/interpreter"> <link href="/static/frontend/frontend.min.css?version=prod-frontend-00090-vzc" rel="stylesheet"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Go Packages"> <title>interpreter package - github.com/google/cel-go/interpreter - Go Packages</title> <link href="/static/frontend/unit/unit.min.css?version=prod-frontend-00090-vzc" rel="stylesheet"> <link href="/static/frontend/unit/main/main.min.css?version=prod-frontend-00090-vzc" rel="stylesheet"> </head> <body> <script> function loadScript(src, mod = true) { let s = document.createElement('script'); s.src = src; if (mod) { s.type = 'module'; s.async = true; s.defer = true } document.head.appendChild(s); } loadScript("/third_party/dialog-polyfill/dialog-polyfill.js", false) loadScript("/static/frontend/frontend.js"); </script> <header class="go-Header go-Header--full js-siteHeader"> <div class="go-Header-inner go-Header-inner--dark"> <nav class="go-Header-nav"> <a href="https://go.dev/" class="js-headerLogo" data-gtmc="nav link" data-test-id="go-header-logo-link" role="heading" aria-level="1"> <img class="go-Header-logo" src="/static/shared/logo/go-white.svg" alt="Go"> </a> <div class="skip-navigation-wrapper"> <a class="skip-to-content-link" aria-label="Skip to main content" href="#main-content"> Skip to Main Content </a> </div> <div class="go-Header-rightContent"> <div class="go-SearchForm js-searchForm"> <form class="go-InputGroup go-ShortcutKey go-SearchForm-form" action="/search" data-shortcut="/" data-shortcut-alt="search" data-gtmc="search form" aria-label="Search for a package" role="search" > <input name="q" class="go-Input js-searchFocus" aria-label="Search for a package" type="search" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" placeholder="Search packages or symbols" value="" /> <input name="m" value="" hidden> <button class="go-Button go-Button--inverted" aria-label="Submit search"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/search_gm_grey_24dp.svg" alt="" /> </button> </form> <button class="go-SearchForm-expandSearch js-expandSearch" data-gtmc="nav button" aria-label="Open search" data-test-id="expand-search"> <img class="go-Icon go-Icon--inverted" height="24" width="24" src="/static/shared/icon/search_gm_grey_24dp.svg" alt=""> </button> </div> <ul class="go-Header-menu"> <li class="go-Header-menuItem"> <a class="js-desktop-menu-hover" href="#" data-gtmc="nav link"> Why Go <img class="go-Icon" height="24" width="24" src="/static/shared/icon/arrow_drop_down_gm_grey_24dp.svg" alt="submenu dropdown icon"> </a> <ul class="go-Header-submenu go-Header-submenu--why js-desktop-submenu-hover" aria-label="submenu"> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/solutions#case-studies"> </span>Case Studies</span> </a> </div> <p>Common problems companies solve with Go</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/solutions#use-cases"> </span>Use Cases</span> </a> </div> <p>Stories about how and why companies use Go</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/security/policy/"> </span>Security Policy</span> </a> </div> <p>How Go can help keep you secure by default</p> </li> </ul> </li> <li class="go-Header-menuItem"> <a href="https://go.dev/learn/" data-gtmc="nav link">Learn</a> </li> <li class="go-Header-menuItem"> <a class="js-desktop-menu-hover" href="#" data-gtmc="nav link"> Docs <img class="go-Icon" height="24" width="24" src="/static/shared/icon/arrow_drop_down_gm_grey_24dp.svg" alt="submenu dropdown icon"> </a> <ul class="go-Header-submenu go-Header-submenu--docs js-desktop-submenu-hover" aria-label="submenu"> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/doc/effective_go"> <span>Effective Go</span> </a> </div> <p>Tips for writing clear, performant, and idiomatic Go code</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/doc/"> <span>Go User Manual</span> </a> </div> <p>A complete introduction to building software with Go</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://pkg.go.dev/std"> <span>Standard library</span> </a> </div> <p>Reference documentation for Go's standard library</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/doc/devel/release"> <span>Release Notes</span> </a> </div> <p>Learn what's new in each Go release</p> </li> </ul> </li> <li class="go-Header-menuItem go-Header-menuItem--active"> <a href="/" data-gtmc="nav link">Packages</a> </li> <li class="go-Header-menuItem"> <a class="js-desktop-menu-hover" href="#" data-gtmc="nav link"> Community <img class="go-Icon" height="24" width="24" src="/static/shared/icon/arrow_drop_down_gm_grey_24dp.svg" alt="submenu dropdown icon"> </a> <ul class="go-Header-submenu go-Header-submenu--community js-desktop-submenu-hover" aria-label="submenu"> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/talks/"> <span>Recorded Talks</span> </a> </div> <p>Videos from prior events</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://www.meetup.com/pro/go"> <span>Meetups</span> <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/launch_gm_grey_24dp.svg" alt=""> </i> </a> </div> <p>Meet other local Go developers</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://github.com/golang/go/wiki/Conferences"> <span>Conferences</span> <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/launch_gm_grey_24dp.svg" alt=""> </i> </a> </div> <p>Learn and network with Go developers from around the world</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/blog"> <span>Go blog</span> </a> </div> <p>The Go project's official blog.</p> </li> <li class="go-Header-submenuItem"> <div> <a href="https://go.dev/help"> <span>Go project</span> </a> </div> <p>Get help and stay informed from Go</p> </li> <li class="go-Header-submenuItem"> <div> Get connected </div> <p></p> <div class="go-Header-socialIcons"> <a class="go-Header-socialIcon" aria-label="Get connected with google-groups (Opens in new window)" href="https://groups.google.com/g/golang-nuts" ><img src="/static/shared/logo/social/google-groups.svg" /></a> <a class="go-Header-socialIcon" aria-label="Get connected with github (Opens in new window)" href="https://github.com/golang"><img src="/static/shared/logo/social/github.svg" /></a> <a class="go-Header-socialIcon" aria-label="Get connected with twitter (Opens in new window)" href="https://twitter.com/golang"><img src="/static/shared/logo/social/twitter.svg" /></a> <a class="go-Header-socialIcon" aria-label="Get connected with reddit (Opens in new window)" href="https://www.reddit.com/r/golang/"><img src="/static/shared/logo/social/reddit.svg" /></a> <a class="go-Header-socialIcon" aria-label="Get connected with slack (Opens in new window)" href="https://invite.slack.golangbridge.org/"><img src="/static/shared/logo/social/slack.svg" /></a> <a class="go-Header-socialIcon" aria-label="Get connected with stack-overflow (Opens in new window)" href="https://stackoverflow.com/collectives/go"><img src="/static/shared/logo/social/stack-overflow.svg" /></a> </div> </li> </ul> </li> </ul> <button class="go-Header-navOpen js-headerMenuButton go-Header-navOpen--white" data-gtmc="nav button" aria-label="Open navigation"> </button> </div> </nav> </div> </header> <aside class="go-NavigationDrawer js-header"> <nav class="go-NavigationDrawer-nav"> <div class="go-NavigationDrawer-header"> <a href="https://go.dev/"> <img class="go-NavigationDrawer-logo" src="/static/shared/logo/go-blue.svg" alt="Go."> </a> </div> <ul class="go-NavigationDrawer-list"> <li class="go-NavigationDrawer-listItem js-mobile-subnav-trigger go-NavigationDrawer-hasSubnav"> <a href="#"> <span>Why Go</span> <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/navigate_next_gm_grey_24dp.svg" alt=""> </i> </a> <div class="go-NavigationDrawer go-NavigationDrawer-submenuItem"> <div class="go-NavigationDrawer-nav"> <div class="go-NavigationDrawer-header"> <a href="#"> <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/navigate_before_gm_grey_24dp.svg" alt=""> </i> Why Go </a> </div> <ul class="go-NavigationDrawer-list"> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/solutions#case-studies"> Case Studies </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/solutions#use-cases"> Use Cases </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/security/policy/"> Security Policy </a> </li> </ul> </div> </div> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/learn/">Learn</a> </li> <li class="go-NavigationDrawer-listItem js-mobile-subnav-trigger go-NavigationDrawer-hasSubnav"> <a href="#"> <span>Docs</span> <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/navigate_next_gm_grey_24dp.svg" alt=""> </i> </a> <div class="go-NavigationDrawer go-NavigationDrawer-submenuItem"> <div class="go-NavigationDrawer-nav"> <div class="go-NavigationDrawer-header"> <a href="#"><i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/navigate_before_gm_grey_24dp.svg" alt=""> </i> Docs </a> </div> <ul class="go-NavigationDrawer-list"> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/doc/effective_go"> Effective Go </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/doc/"> Go User Manual </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://pkg.go.dev/std"> Standard library </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/doc/devel/release"> Release Notes </a> </li> </ul> </div> </div> </li> <li class="go-NavigationDrawer-listItem go-NavigationDrawer-listItem--active"> <a href="/">Packages</a> </li> <li class="go-NavigationDrawer-listItem js-mobile-subnav-trigger go-NavigationDrawer-hasSubnav"> <a href="#"> <span>Community</span> <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/navigate_next_gm_grey_24dp.svg" alt=""> </i> </a> <div class="go-NavigationDrawer go-NavigationDrawer-submenuItem"> <div class="go-NavigationDrawer-nav"> <div class="go-NavigationDrawer-header"> <a href="#"> <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/navigate_before_gm_grey_24dp.svg" alt=""> </i> Community </a> </div> <ul class="go-NavigationDrawer-list"> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/talks/"> Recorded Talks </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://www.meetup.com/pro/go"> Meetups <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/launch_gm_grey_24dp.svg" alt=""> </i> </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://github.com/golang/go/wiki/Conferences"> Conferences <i class="material-icons"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/launch_gm_grey_24dp.svg" alt=""> </i> </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/blog"> Go blog </a> </li> <li class="go-NavigationDrawer-listItem"> <a href="https://go.dev/help"> Go project </a> </li> <li class="go-NavigationDrawer-listItem"> <div>Get connected</div> <div class="go-Header-socialIcons"> <a class="go-Header-socialIcon" href="https://groups.google.com/g/golang-nuts"><img src="/static/shared/logo/social/google-groups.svg" /></a> <a class="go-Header-socialIcon" href="https://github.com/golang"><img src="/static/shared/logo/social/github.svg" /></a> <a class="go-Header-socialIcon" href="https://twitter.com/golang"><img src="/static/shared/logo/social/twitter.svg" /></a> <a class="go-Header-socialIcon" href="https://www.reddit.com/r/golang/"><img src="/static/shared/logo/social/reddit.svg" /></a> <a class="go-Header-socialIcon" href="https://invite.slack.golangbridge.org/"><img src="/static/shared/logo/social/slack.svg" /></a> <a class="go-Header-socialIcon" href="https://stackoverflow.com/collectives/go"><img src="/static/shared/logo/social/stack-overflow.svg" /></a> </div> </li> </ul> </div> </div> </li> </ul> </nav> </aside> <div class="go-NavigationDrawer-scrim js-scrim" role="presentation"></div> <main class="go-Main" id="main-content"> <div class="go-Main-banner" role="alert"></div> <header class="go-Main-header js-mainHeader"> <nav class="go-Main-headerBreadcrumb go-Breadcrumb" aria-label="Breadcrumb" data-test-id="UnitHeader-breadcrumb"> <ol> <li data-test-id="UnitHeader-breadcrumbItem"> <a href="/" data-gtmc="breadcrumb link">Discover Packages</a> </li> <li data-test-id="UnitHeader-breadcrumbItem"> <a href="/github.com/google/cel-go" data-gtmc="breadcrumb link">github.com/google/cel-go</a> </li> <li> <a href="/github.com/google/cel-go@v0.22.1/interpreter" data-gtmc="breadcrumb link" aria-current="location" data-test-id="UnitHeader-breadcrumbCurrent"> interpreter </a> <button class="go-Button go-Button--inline go-Clipboard js-clipboard" title="Copy path to clipboard. github.com/google/cel-go/interpreter" aria-label="Copy Path to Clipboard" data-to-copy="github.com/google/cel-go/interpreter" data-gtmc="breadcrumbs button" > <img class="go-Icon go-Icon--accented" height="24" width="24" src="/static/shared/icon/content_copy_gm_grey_24dp.svg" alt="" > </button> </li> </ol> </nav> <div class="go-Main-headerContent"> <div class="go-Main-headerTitle js-stickyHeader"> <a class="go-Main-headerLogo" href="https://go.dev/" aria-hidden="true" tabindex="-1" data-gtmc="header link" aria-label="Link to Go Homepage"> <img height="78" width="207" src="/static/shared/logo/go-blue.svg" alt="Go"> </a> <h1 class="UnitHeader-titleHeading" data-test-id="UnitHeader-title">interpreter</h1> <span class="go-Chip go-Chip--inverted">package</span> <button class="go-Button go-Button--inline go-Clipboard js-clipboard" title="Copy path to clipboard. github.com/google/cel-go/interpreter" aria-label="Copy Path to Clipboard" data-to-copy="github.com/google/cel-go/interpreter" data-gtmc="title button" tabindex="-1" > <img class="go-Icon go-Icon--accented" height="24" width="24" src="/static/shared/icon/content_copy_gm_grey_24dp.svg" alt="" /> </button> </div> <div class="go-Main-headerDetails"> <span class="go-Main-headerDetailItem" data-test-id="UnitHeader-version"> <a href="?tab=versions" aria-label="Version: v0.22.1" data-gtmc="header link" aria-describedby="version-description"> <span class="go-textSubtle" aria-hidden="true">Version: </span> v0.22.1 </a> <div class="screen-reader-only" id="version-description" hidden> Opens a new window with list of versions in this module. </div> <span class="DetailsHeader-badge--latest" data-test-id="UnitHeader-minorVersionBanner"> <span class="go-Chip DetailsHeader-span--latest">Latest</span> <span class="go-Chip DetailsHeader-span--notAtLatest"> Latest <details class="go-Tooltip js-tooltip" data-gtmc="tooltip"> <summary> <img class="go-Icon go-Icon--inverted" height="24" width="24" src="/static/shared/icon/alert_gm_grey_24dp.svg" alt="Warning"> </summary> <p>This package is not in the latest version of its module.</p> </details> </span> <a href="/github.com/google/cel-go/interpreter" aria-label="Go to Latest Version" data-gtmc="header link"> <span class="go-Chip go-Chip--alert DetailsHeader-span--goToLatest">Go to latest</span> </a> </span> </span> <span class="go-Main-headerDetailItem" data-test-id="UnitHeader-commitTime"> Published: Nov 22, 2024 </span> <span class="go-Main-headerDetailItem" data-test-id="UnitHeader-licenses"> License: <a href="/github.com/google/cel-go/interpreter?tab=licenses" data-test-id="UnitHeader-license" data-gtmc="header link" aria-describedby="license-description">Apache-2.0, BSD-3-Clause</a> </span> <div class="screen-reader-only" id="license-description" hidden> Opens a new window with license information. </div> <span class="go-Main-headerDetailItem" data-test-id="UnitHeader-imports"> <a href="/github.com/google/cel-go/interpreter?tab=imports" aria-label="Imports: 15" data-gtmc="header link" aria-describedby="imports-description"> <span class="go-textSubtle">Imports: </span>15 </a> </span> <div class="screen-reader-only" id="imports-description" hidden> Opens a new window with list of imports. </div> <span class="go-Main-headerDetailItem" data-test-id="UnitHeader-importedby"> <a href="/github.com/google/cel-go/interpreter?tab=importedby" aria-label="Imported By: 49" data-gtmc="header link" aria-describedby="importedby-description"> <span class="go-textSubtle">Imported by: </span>49 </a> </span> <div class="screen-reader-only" id="importedby-description" hidden> Opens a new window with list of known importers. </div> </div> <div class="UnitHeader-overflowContainer"> <svg class="UnitHeader-overflowImage" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"> <path d="M0 0h24v24H0z" fill="none"/> <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/> </svg> <select class="UnitHeader-overflowSelect js-selectNav" tabindex="-1"> <option value="/">Main</option> <option value="/github.com/google/cel-go/interpreter?tab=versions"> Versions </option> <option value="/github.com/google/cel-go/interpreter?tab=licenses"> Licenses </option> <option value="/github.com/google/cel-go/interpreter?tab=imports"> Imports </option> <option value="/github.com/google/cel-go/interpreter?tab=importedby"> Imported By </option> </select> </div> </div> </header> <aside class="go-Main-aside js-mainAside"> <div class="UnitMeta"> <h2 class="go-textLabel">Details</h2> <ul class="UnitMeta-details"> <li> <details class="go-Tooltip js-tooltip" data-gtmc="tooltip"> <summary class="go-textSubtle"> <img class="go-Icon go-Icon--accented"src="/static/shared/icon/check_circle_gm_grey_24dp.svg" alt="checked"height="24" width="24"> Valid <a href="https://github.com/google/cel-go/tree/v0.22.1/go.mod" target="_blank" rel="noopener">go.mod</a> file <img class="go-Icon" src="/static/shared/icon/help_gm_grey_24dp.svg" alt="" height="24" width="24"> </summary> <p> The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go. </p> </details> </li> <li> <details class="go-Tooltip js-tooltip" data-gtmc="tooltip"> <summary class="go-textSubtle"> <img class="go-Icon go-Icon--accented"src="/static/shared/icon/check_circle_gm_grey_24dp.svg" alt="checked"height="24" width="24"> Redistributable license <img class="go-Icon" src="/static/shared/icon/help_gm_grey_24dp.svg" alt="" height="24" width="24"> </summary> <p> Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed. </p> </details> </li> <li> <details class="go-Tooltip js-tooltip" data-gtmc="tooltip"> <summary class="go-textSubtle"> <img class="go-Icon go-Icon--accented"src="/static/shared/icon/check_circle_gm_grey_24dp.svg" alt="checked"height="24" width="24"> Tagged version <img class="go-Icon" src="/static/shared/icon/help_gm_grey_24dp.svg" alt="" height="24" width="24"> </summary> <p>Modules with tagged versions give importers more predictable builds.</p> </details> </li> <li> <details class="go-Tooltip js-tooltip" data-gtmc="tooltip"> <summary class="go-textSubtle"> <img class="go-Icon"src="/static/shared/icon/cancel_gm_grey_24dp.svg" alt="unchecked"height="24" width="24"> Stable version <img class="go-Icon" src="/static/shared/icon/help_gm_grey_24dp.svg" alt="" height="24" width="24"> </summary> <p>When a project reaches major version v1 it is considered stable.</p> </details> </li> <li class="UnitMeta-detailsLearn"> <a href="/about#best-practices" data-gtmc="meta link">Learn more about best practices</a> </li> </ul> <h2 class="go-textLabel">Repository</h2> <div class="UnitMeta-repo"> <a href="https://github.com/google/cel-go" title="https://github.com/google/cel-go" target="_blank" rel="noopener"> github.com/google/cel-go </a> </div> <h2 class="go-textLabel">Links</h2> <ul class="UnitMeta-links"> <li> <a href="https://deps.dev/go/github.com%2Fgoogle%2Fcel-go/v0.22.1" title="View this module on Open Source Insights" target="_blank" rel="noopener" data-test-id="meta-link-depsdev"> <img class="depsdev-Icon" src="/static/shared/icon/depsdev-logo.svg" alt="Open Source Insights Logo" /> Open Source Insights </a> </li> </ul> </div> </aside> <nav class="go-Main-nav go-Main-nav--sticky js-mainNav" aria-label="Outline"> <div class="go-Main-navDesktop"> <div class="UnitOutline-jumpTo"> <button class="UnitOutline-jumpToInput go-ShortcutKey js-jumpToInput" aria-controls="jump-to-modal" aria-label="Open Jump to Identifier" data-shortcut="f" data-shortcut-alt="find" data-test-id="jump-to-button" data-gtmc="outline button"> Jump to ... </button> </div> <ul class="go-Tree js-tree" role="tree" aria-label="Outline"> <li> <a href="#section-documentation" data-gtmc="outline link"> Documentation </a> <ul> <li> <a href="#pkg-overview" data-gtmc="doc outline link">Overview</a> </li> <li class="DocNav-overview"> <a href="#pkg-index" data-gtmc="doc outline link"> Index </a> </li> <li class="DocNav-constants"> <a href="#pkg-constants" data-gtmc="doc outline link"> Constants </a> </li> <li class="DocNav-variables"> <a href="#pkg-variables" data-gtmc="doc outline link"> Variables </a> </li> <li class="DocNav-functions"> <a href="#pkg-functions" data-gtmc="doc outline link"> Functions </a> <ul> <li> <a href="#PruneAst" title="PruneAst(expr, macroCalls, state)" data-gtmc="doc outline link"> PruneAst(expr, macroCalls, state) </a> </li> </ul> </li> <li class="DocNav-types"> <a href="#pkg-types" data-gtmc="doc outline link"> Types </a> <ul> <li> <a href="#Activation" title="type Activation" data-gtmc="doc outline link"> type Activation </a> <ul> <li> <a href="#EmptyActivation" title="EmptyActivation()" data-gtmc="doc outline link"> EmptyActivation() </a> </li> <li> <a href="#NewActivation" title="NewActivation(bindings)" data-gtmc="doc outline link"> NewActivation(bindings) </a> </li> <li> <a href="#NewHierarchicalActivation" title="NewHierarchicalActivation(parent, child)" data-gtmc="doc outline link"> NewHierarchicalActivation(parent, child) </a> </li> </ul> </li> <li> <a href="#ActualCostEstimator" title="type ActualCostEstimator" data-gtmc="doc outline link"> type ActualCostEstimator </a> </li> <li> <a href="#AttrFactoryOption" title="type AttrFactoryOption" data-gtmc="doc outline link"> type AttrFactoryOption </a> <ul> <li> <a href="#EnableErrorOnBadPresenceTest" title="EnableErrorOnBadPresenceTest(value)" data-gtmc="doc outline link"> EnableErrorOnBadPresenceTest(value) </a> </li> </ul> </li> <li> <a href="#Attribute" title="type Attribute" data-gtmc="doc outline link"> type Attribute </a> </li> <li> <a href="#AttributeFactory" title="type AttributeFactory" data-gtmc="doc outline link"> type AttributeFactory </a> <ul> <li> <a href="#NewAttributeFactory" title="NewAttributeFactory(cont, a, p, opts)" data-gtmc="doc outline link"> NewAttributeFactory(cont, a, p, opts) </a> </li> <li> <a href="#NewPartialAttributeFactory" title="NewPartialAttributeFactory(container, adapter, provider, opts)" data-gtmc="doc outline link"> NewPartialAttributeFactory(container, adapter, provider, opts) </a> </li> </ul> </li> <li> <a href="#AttributePattern" title="type AttributePattern" data-gtmc="doc outline link"> type AttributePattern </a> <ul> <li> <a href="#NewAttributePattern" title="NewAttributePattern(variable)" data-gtmc="doc outline link"> NewAttributePattern(variable) </a> </li> <li> <a href="#AttributePattern.QualBool" title="(apat) QualBool(pattern)" data-gtmc="doc outline link"> (apat) QualBool(pattern) </a> </li> <li> <a href="#AttributePattern.QualInt" title="(apat) QualInt(pattern)" data-gtmc="doc outline link"> (apat) QualInt(pattern) </a> </li> <li> <a href="#AttributePattern.QualString" title="(apat) QualString(pattern)" data-gtmc="doc outline link"> (apat) QualString(pattern) </a> </li> <li> <a href="#AttributePattern.QualUint" title="(apat) QualUint(pattern)" data-gtmc="doc outline link"> (apat) QualUint(pattern) </a> </li> <li> <a href="#AttributePattern.QualifierPatterns" title="(apat) QualifierPatterns()" data-gtmc="doc outline link"> (apat) QualifierPatterns() </a> </li> <li> <a href="#AttributePattern.VariableMatches" title="(apat) VariableMatches(variable)" data-gtmc="doc outline link"> (apat) VariableMatches(variable) </a> </li> <li> <a href="#AttributePattern.Wildcard" title="(apat) Wildcard()" data-gtmc="doc outline link"> (apat) Wildcard() </a> </li> </ul> </li> <li> <a href="#AttributeQualifierPattern" title="type AttributeQualifierPattern" data-gtmc="doc outline link"> type AttributeQualifierPattern </a> <ul> <li> <a href="#AttributeQualifierPattern.Matches" title="(qpat) Matches(q)" data-gtmc="doc outline link"> (qpat) Matches(q) </a> </li> </ul> </li> <li> <a href="#CancellationCause" title="type CancellationCause" data-gtmc="doc outline link"> type CancellationCause </a> </li> <li> <a href="#ConstantQualifier" title="type ConstantQualifier" data-gtmc="doc outline link"> type ConstantQualifier </a> </li> <li> <a href="#CostTracker" title="type CostTracker" data-gtmc="doc outline link"> type CostTracker </a> <ul> <li> <a href="#NewCostTracker" title="NewCostTracker(estimator, opts)" data-gtmc="doc outline link"> NewCostTracker(estimator, opts) </a> </li> <li> <a href="#CostTracker.ActualCost" title="(c) ActualCost()" data-gtmc="doc outline link"> (c) ActualCost() </a> </li> </ul> </li> <li> <a href="#CostTrackerOption" title="type CostTrackerOption" data-gtmc="doc outline link"> type CostTrackerOption </a> <ul> <li> <a href="#CostTrackerLimit" title="CostTrackerLimit(limit)" data-gtmc="doc outline link"> CostTrackerLimit(limit) </a> </li> <li> <a href="#OverloadCostTracker" title="OverloadCostTracker(overloadID, fnTracker)" data-gtmc="doc outline link"> OverloadCostTracker(overloadID, fnTracker) </a> </li> <li> <a href="#PresenceTestHasCost" title="PresenceTestHasCost(hasCost)" data-gtmc="doc outline link"> PresenceTestHasCost(hasCost) </a> </li> </ul> </li> <li> <a href="#Dispatcher" title="type Dispatcher" data-gtmc="doc outline link"> type Dispatcher </a> <ul> <li> <a href="#ExtendDispatcher" title="ExtendDispatcher(parent)" data-gtmc="doc outline link"> ExtendDispatcher(parent) </a> </li> <li> <a href="#NewDispatcher" title="NewDispatcher()" data-gtmc="doc outline link"> NewDispatcher() </a> </li> </ul> </li> <li> <a href="#EvalCancelledError" title="type EvalCancelledError" data-gtmc="doc outline link"> type EvalCancelledError </a> <ul> <li> <a href="#EvalCancelledError.Error" title="(e) Error()" data-gtmc="doc outline link"> (e) Error() </a> </li> </ul> </li> <li> <a href="#EvalObserver" title="type EvalObserver" data-gtmc="doc outline link"> type EvalObserver </a> <ul> <li> <a href="#CostObserver" title="CostObserver(tracker)" data-gtmc="doc outline link"> CostObserver(tracker) </a> </li> <li> <a href="#EvalStateObserver" title="EvalStateObserver(state)" data-gtmc="doc outline link"> EvalStateObserver(state) </a> </li> </ul> </li> <li> <a href="#EvalState" title="type EvalState" data-gtmc="doc outline link"> type EvalState </a> <ul> <li> <a href="#NewEvalState" title="NewEvalState()" data-gtmc="doc outline link"> NewEvalState() </a> </li> </ul> </li> <li> <a href="#FunctionTracker" title="type FunctionTracker" data-gtmc="doc outline link"> type FunctionTracker </a> </li> <li> <a href="#Interpretable" title="type Interpretable" data-gtmc="doc outline link"> type Interpretable </a> </li> <li> <a href="#InterpretableAttribute" title="type InterpretableAttribute" data-gtmc="doc outline link"> type InterpretableAttribute </a> </li> <li> <a href="#InterpretableCall" title="type InterpretableCall" data-gtmc="doc outline link"> type InterpretableCall </a> <ul> <li> <a href="#NewCall" title="NewCall(id, function, overload, args, impl)" data-gtmc="doc outline link"> NewCall(id, function, overload, args, impl) </a> </li> </ul> </li> <li> <a href="#InterpretableConst" title="type InterpretableConst" data-gtmc="doc outline link"> type InterpretableConst </a> <ul> <li> <a href="#NewConstValue" title="NewConstValue(id, val)" data-gtmc="doc outline link"> NewConstValue(id, val) </a> </li> </ul> </li> <li> <a href="#InterpretableConstructor" title="type InterpretableConstructor" data-gtmc="doc outline link"> type InterpretableConstructor </a> </li> <li> <a href="#InterpretableDecorator" title="type InterpretableDecorator" data-gtmc="doc outline link"> type InterpretableDecorator </a> <ul> <li> <a href="#CompileRegexConstants" title="CompileRegexConstants(regexOptimizations)" data-gtmc="doc outline link"> CompileRegexConstants(regexOptimizations) </a> </li> <li> <a href="#ExhaustiveEval" title="ExhaustiveEval()" data-gtmc="doc outline link"> ExhaustiveEval() </a> </li> <li> <a href="#InterruptableEval" title="InterruptableEval()" data-gtmc="doc outline link"> InterruptableEval() </a> </li> <li> <a href="#Observe" title="Observe(observers)" data-gtmc="doc outline link"> Observe(observers) </a> </li> <li> <a href="#Optimize" title="Optimize()" data-gtmc="doc outline link"> Optimize() </a> </li> <li> <a href="#TrackState" title="TrackState(state)" data-gtmc="doc outline link"> TrackState(state) </a> </li> </ul> </li> <li> <a href="#Interpreter" title="type Interpreter" data-gtmc="doc outline link"> type Interpreter </a> <ul> <li> <a href="#NewInterpreter" title="NewInterpreter(dispatcher, container, provider, adapter, attrFactory)" data-gtmc="doc outline link"> NewInterpreter(dispatcher, container, provider, adapter, attrFactory) </a> </li> </ul> </li> <li> <a href="#NamespacedAttribute" title="type NamespacedAttribute" data-gtmc="doc outline link"> type NamespacedAttribute </a> </li> <li> <a href="#PartialActivation" title="type PartialActivation" data-gtmc="doc outline link"> type PartialActivation </a> <ul> <li> <a href="#NewPartialActivation" title="NewPartialActivation(bindings, unknowns)" data-gtmc="doc outline link"> NewPartialActivation(bindings, unknowns) </a> </li> </ul> </li> <li> <a href="#Qualifier" title="type Qualifier" data-gtmc="doc outline link"> type Qualifier </a> </li> <li> <a href="#RegexOptimization" title="type RegexOptimization" data-gtmc="doc outline link"> type RegexOptimization </a> </li> </ul> </li> </ul> </li> <li> <a href="#section-sourcefiles" data-gtmc="outline link"> Source Files </a> </li> <li> <a href="#section-directories" data-gtmc="outline link"> Directories </a> </li> </ul> </div> <div class="go-Main-navMobile js-mainNavMobile"> <label class="go-Label"> <select class="go-Select"> <option selected disabled>Documentation</option> </select> </label> </div> </nav> <article class="go-Main-article js-mainContent"> <div class="UnitDetails" data-test-id="UnitDetails" style="display: block;"> <div class="UnitDetails-content js-unitDetailsContent" data-test-id="UnitDetails-content"> <div class="UnitDoc"> <h2 class="UnitDoc-title" id="section-documentation"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/code_gm_grey_24dp.svg" alt=""> Documentation <a class="UnitDoc-idLink" href="#section-documentation" aria-label="Go to Documentation">露</a> </h2> <div class="Documentation js-documentation"> <div class="Documentation-content js-docContent"> <section class="Documentation-overview"> <h3 tabindex="-1" id="pkg-overview" class="Documentation-overviewHeader">Overview <a href="#pkg-overview" aria-label="Go to Overview">露</a></h3> <p>Package interpreter provides functions to evaluate parsed expressions with the option to augment the evaluation with inputs and functions supplied at evaluation time. </p> </section><section class="Documentation-index"> <h3 id="pkg-index" class="Documentation-indexHeader">Index <a href="#pkg-index" aria-label="Go to Index">露</a></h3> <ul class="Documentation-indexList"> <li class="Documentation-indexVariables"><a href="#pkg-variables">Variables</a></li> <li class="Documentation-indexFunction"> <a href="#PruneAst">func PruneAst(expr ast.Expr, macroCalls map[int64]ast.Expr, state EvalState) *ast.AST</a></li> <li class="Documentation-indexType"> <a href="#Activation">type Activation</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#EmptyActivation">func EmptyActivation() Activation</a></li> <li> <a href="#NewActivation">func NewActivation(bindings any) (Activation, error)</a></li> <li> <a href="#NewHierarchicalActivation">func NewHierarchicalActivation(parent Activation, child Activation) Activation</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#ActualCostEstimator">type ActualCostEstimator</a></li> <li class="Documentation-indexType"> <a href="#AttrFactoryOption">type AttrFactoryOption</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#EnableErrorOnBadPresenceTest">func EnableErrorOnBadPresenceTest(value bool) AttrFactoryOption</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#Attribute">type Attribute</a></li> <li class="Documentation-indexType"> <a href="#AttributeFactory">type AttributeFactory</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewAttributeFactory">func NewAttributeFactory(cont *containers.Container, a types.Adapter, p types.Provider, ...) AttributeFactory</a></li> <li> <a href="#NewPartialAttributeFactory">func NewPartialAttributeFactory(container *containers.Container, adapter types.Adapter, ...) AttributeFactory</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#AttributePattern">type AttributePattern</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewAttributePattern">func NewAttributePattern(variable string) *AttributePattern</a></li> </ul></li> <li><ul class="Documentation-indexTypeMethods"> <li> <a href="#AttributePattern.QualBool">func (apat *AttributePattern) QualBool(pattern bool) *AttributePattern</a></li> <li> <a href="#AttributePattern.QualInt">func (apat *AttributePattern) QualInt(pattern int64) *AttributePattern</a></li> <li> <a href="#AttributePattern.QualString">func (apat *AttributePattern) QualString(pattern string) *AttributePattern</a></li> <li> <a href="#AttributePattern.QualUint">func (apat *AttributePattern) QualUint(pattern uint64) *AttributePattern</a></li> <li> <a href="#AttributePattern.QualifierPatterns">func (apat *AttributePattern) QualifierPatterns() []*AttributeQualifierPattern</a></li> <li> <a href="#AttributePattern.VariableMatches">func (apat *AttributePattern) VariableMatches(variable string) bool</a></li> <li> <a href="#AttributePattern.Wildcard">func (apat *AttributePattern) Wildcard() *AttributePattern</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#AttributeQualifierPattern">type AttributeQualifierPattern</a></li> <li><ul class="Documentation-indexTypeMethods"> <li> <a href="#AttributeQualifierPattern.Matches">func (qpat *AttributeQualifierPattern) Matches(q Qualifier) bool</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#CancellationCause">type CancellationCause</a></li> <li class="Documentation-indexType"> <a href="#ConstantQualifier">type ConstantQualifier</a></li> <li class="Documentation-indexType"> <a href="#CostTracker">type CostTracker</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewCostTracker">func NewCostTracker(estimator ActualCostEstimator, opts ...CostTrackerOption) (*CostTracker, error)</a></li> </ul></li> <li><ul class="Documentation-indexTypeMethods"> <li> <a href="#CostTracker.ActualCost">func (c *CostTracker) ActualCost() uint64</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#CostTrackerOption">type CostTrackerOption</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#CostTrackerLimit">func CostTrackerLimit(limit uint64) CostTrackerOption</a></li> <li> <a href="#OverloadCostTracker">func OverloadCostTracker(overloadID string, fnTracker FunctionTracker) CostTrackerOption</a></li> <li> <a href="#PresenceTestHasCost">func PresenceTestHasCost(hasCost bool) CostTrackerOption</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#Dispatcher">type Dispatcher</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#ExtendDispatcher">func ExtendDispatcher(parent Dispatcher) Dispatcher</a></li> <li> <a href="#NewDispatcher">func NewDispatcher() Dispatcher</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#EvalCancelledError">type EvalCancelledError</a></li> <li><ul class="Documentation-indexTypeMethods"> <li> <a href="#EvalCancelledError.Error">func (e EvalCancelledError) Error() string</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#EvalObserver">type EvalObserver</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#CostObserver">func CostObserver(tracker *CostTracker) EvalObserver</a></li> <li> <a href="#EvalStateObserver">func EvalStateObserver(state EvalState) EvalObserver</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#EvalState">type EvalState</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewEvalState">func NewEvalState() EvalState</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#FunctionTracker">type FunctionTracker</a></li> <li class="Documentation-indexType"> <a href="#Interpretable">type Interpretable</a></li> <li class="Documentation-indexType"> <a href="#InterpretableAttribute">type InterpretableAttribute</a></li> <li class="Documentation-indexType"> <a href="#InterpretableCall">type InterpretableCall</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewCall">func NewCall(id int64, function, overload string, args []Interpretable, ...) InterpretableCall</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#InterpretableConst">type InterpretableConst</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewConstValue">func NewConstValue(id int64, val ref.Val) InterpretableConst</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#InterpretableConstructor">type InterpretableConstructor</a></li> <li class="Documentation-indexType"> <a href="#InterpretableDecorator">type InterpretableDecorator</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#CompileRegexConstants">func CompileRegexConstants(regexOptimizations ...*RegexOptimization) InterpretableDecorator</a></li> <li> <a href="#ExhaustiveEval">func ExhaustiveEval() InterpretableDecorator</a></li> <li> <a href="#InterruptableEval">func InterruptableEval() InterpretableDecorator</a></li> <li> <a href="#Observe">func Observe(observers ...EvalObserver) InterpretableDecorator</a></li> <li> <a href="#Optimize">func Optimize() InterpretableDecorator</a></li> <li> <a href="#TrackState">func TrackState(state EvalState) InterpretableDecorator</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#Interpreter">type Interpreter</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewInterpreter">func NewInterpreter(dispatcher Dispatcher, container *containers.Container, ...) Interpreter</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#NamespacedAttribute">type NamespacedAttribute</a></li> <li class="Documentation-indexType"> <a href="#PartialActivation">type PartialActivation</a></li> <li><ul class="Documentation-indexTypeFunctions"> <li> <a href="#NewPartialActivation">func NewPartialActivation(bindings any, unknowns ...*AttributePattern) (PartialActivation, error)</a></li> </ul></li> <li class="Documentation-indexType"> <a href="#Qualifier">type Qualifier</a></li> <li class="Documentation-indexType"> <a href="#RegexOptimization">type RegexOptimization</a></li> </ul> </section><h3 tabindex="-1" id="pkg-constants" class="Documentation-constantsHeader">Constants <a href="#pkg-constants" aria-label="Go to Constants">露</a></h3> <section class="Documentation-constants"><p class="Documentation-empty">This section is empty.</p></section> <h3 tabindex="-1" id="pkg-variables" class="Documentation-variablesHeader">Variables <a href="#pkg-variables" aria-label="Go to Variables">露</a></h3> <section class="Documentation-variables"> <div class="Documentation-declaration"> <span class="Documentation-declarationLink"><a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/optimizations.go#L27">View Source</a></span> <pre><span id="MatchesRegexOptimization" data-kind="variable">var MatchesRegexOptimization = &<a href="#RegexOptimization">RegexOptimization</a>{ </span> Function: "matches", RegexIndex: 1, Factory: func(call <a href="#InterpretableCall">InterpretableCall</a>, regexPattern <a href="/builtin#string">string</a>) (<a href="#InterpretableCall">InterpretableCall</a>, <a href="/builtin#error">error</a>) { compiledRegex, err := <a href="/regexp">regexp</a>.<a href="/regexp#Compile">Compile</a>(regexPattern) if err != <a href="/builtin#nil">nil</a> { return <a href="/builtin#nil">nil</a>, err } return <a href="#NewCall">NewCall</a>(call.ID(), call.Function(), call.OverloadID(), call.Args(), func(values ...<a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>) <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a> { if <a href="/builtin#len">len</a>(values) != 2 { return <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#NoSuchOverloadErr">NoSuchOverloadErr</a>() } in, ok := values[0].Value().(<a href="/builtin#string">string</a>) if !ok { return <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#NoSuchOverloadErr">NoSuchOverloadErr</a>() } return <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Bool">Bool</a>(compiledRegex.MatchString(in)) }), <a href="/builtin#nil">nil</a> }, }</pre> </div> <p>MatchesRegexOptimization optimizes the 'matches' standard library function by compiling the regex pattern and reporting any compilation errors at program creation time, and using the compiled regex pattern for all function call invocations. </p> </section> <h3 tabindex="-1" id="pkg-functions" class="Documentation-functionsHeader">Functions <a href="#pkg-functions" aria-label="Go to Functions">露</a></h3> <section class="Documentation-functions"><div class="Documentation-function"> <h4 tabindex="-1" id="PruneAst" data-kind="function" class="Documentation-functionHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/prune.go#L69">PruneAst</a> <a class="Documentation-idLink" href="#PruneAst" aria-label="Go to PruneAst">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func PruneAst(expr <a href="/github.com/google/cel-go@v0.22.1/common/ast">ast</a>.<a href="/github.com/google/cel-go@v0.22.1/common/ast#Expr">Expr</a>, macroCalls map[<a href="/builtin#int64">int64</a>]<a href="/github.com/google/cel-go@v0.22.1/common/ast">ast</a>.<a href="/github.com/google/cel-go@v0.22.1/common/ast#Expr">Expr</a>, state <a href="#EvalState">EvalState</a>) *<a href="/github.com/google/cel-go@v0.22.1/common/ast">ast</a>.<a href="/github.com/google/cel-go@v0.22.1/common/ast#AST">AST</a></pre> </div> <p>PruneAst prunes the given AST based on the given EvalState and generates a new AST. Given AST is copied on write and a new AST is returned. Couple of typical use cases this interface would be: </p><p>A) 1) Evaluate expr with some unknowns, 2) If result is unknown: </p><pre>a) PruneAst b) Goto 1 </pre><p>Functional call results which are known would be effectively cached across iterations. </p><p>B) 1) Compile the expression (maybe via a service and maybe after checking a </p><pre>compiled expression does not exists in local cache) </pre><p>2) Prepare the environment and the interpreter. Activation might be empty. 3) Eval the expression. This might return unknown or error or a concrete </p><pre>value. </pre><p>4) PruneAst 4) Maybe cache the expression This is effectively constant folding the expression. How the environment is prepared in step 2 is flexible. For example, If the caller caches the compiled and constant folded expressions, but is not willing to constant fold(and thus cache results of) some external calls, then they can prepare the overloads accordingly. </p> </div></section> <h3 tabindex="-1" id="pkg-types" class="Documentation-typesHeader">Types <a href="#pkg-types" aria-label="Go to Types">露</a></h3> <section class="Documentation-types"><div class="Documentation-type"> <h4 tabindex="-1" id="Activation" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/activation.go#L27">Activation</a> <a class="Documentation-idLink" href="#Activation" aria-label="Go to Activation">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>type Activation interface { <span id="Activation.ResolveName" data-kind="method"> <span class="comment">// ResolveName returns a value from the activation by qualified name, or false if the name</span> </span> <span class="comment">// could not be found.</span> ResolveName(name <a href="/builtin#string">string</a>) (<a href="/builtin#any">any</a>, <a href="/builtin#bool">bool</a>) <span id="Activation.Parent" data-kind="method"> <span class="comment">// Parent returns the parent of the current activation, may be nil.</span> </span> <span class="comment">// If non-nil, the parent will be searched during resolve calls.</span> Parent() <a href="#Activation">Activation</a> }</pre> </div> <p>Activation used to resolve identifiers by name and references by id. </p><p>An Activation is the primary mechanism by which a caller supplies input into a CEL program. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="EmptyActivation" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/activation.go#L38">EmptyActivation</a> <a class="Documentation-idLink" href="#EmptyActivation" aria-label="Go to EmptyActivation">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.2.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func EmptyActivation() <a href="#Activation">Activation</a></pre> </div> <p>EmptyActivation returns a variable-free activation. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewActivation" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/activation.go#L61">NewActivation</a> <a class="Documentation-idLink" href="#NewActivation" aria-label="Go to NewActivation">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func NewActivation(bindings <a href="/builtin#any">any</a>) (<a href="#Activation">Activation</a>, <a href="/builtin#error">error</a>)</pre> </div> <p>NewActivation returns an activation based on a map-based binding where the map keys are expected to be qualified names used with ResolveName calls. </p><p>The input `bindings` may either be of type `Activation` or `map[string]any`. </p><p>Lazy bindings may be supplied within the map-based input in either of the following forms: - func() any - func() ref.Val </p><p>The output of the lazy binding will overwrite the variable reference in the internal map. </p><p>Values which are not represented as ref.Val types on input may be adapted to a ref.Val using the types.Adapter configured in the environment. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewHierarchicalActivation" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/activation.go#L132">NewHierarchicalActivation</a> <a class="Documentation-idLink" href="#NewHierarchicalActivation" aria-label="Go to NewHierarchicalActivation">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func NewHierarchicalActivation(parent <a href="#Activation">Activation</a>, child <a href="#Activation">Activation</a>) <a href="#Activation">Activation</a></pre> </div> <p>NewHierarchicalActivation takes two activations and produces a new one which prioritizes resolution in the child first and parent(s) second. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="ActualCostEstimator" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L33">ActualCostEstimator</a> <a class="Documentation-idLink" href="#ActualCostEstimator" aria-label="Go to ActualCostEstimator">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type ActualCostEstimator interface { <span id="ActualCostEstimator.CallCost" data-kind="method"> CallCost(function, overloadID <a href="/builtin#string">string</a>, args []<a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>, result <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>) *<a href="/builtin#uint64">uint64</a> </span>}</pre> </div> <p>ActualCostEstimator provides function call cost estimations at runtime CallCost returns an estimated cost for the function overload invocation with the given args, or nil if it has no estimate to provide. CEL attempts to provide reasonable estimates for its standard function library, so CallCost should typically not need to provide an estimate for CELs standard function. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="AttrFactoryOption" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L130">AttrFactoryOption</a> <a class="Documentation-idLink" href="#AttrFactoryOption" aria-label="Go to AttrFactoryOption">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.21.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type AttrFactoryOption func(*attrFactory) *attrFactory</pre> </div> <p>AttrFactoryOption specifies a functional option for configuring an attribute factory. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="EnableErrorOnBadPresenceTest" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L134">EnableErrorOnBadPresenceTest</a> <a class="Documentation-idLink" href="#EnableErrorOnBadPresenceTest" aria-label="Go to EnableErrorOnBadPresenceTest">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.21.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func EnableErrorOnBadPresenceTest(value <a href="/builtin#bool">bool</a>) <a href="#AttrFactoryOption">AttrFactoryOption</a></pre> </div> <p>EnableErrorOnBadPresenceTest error generation when a presence test or optional field selection is performed on a primitive type. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="Attribute" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L101">Attribute</a> <a class="Documentation-idLink" href="#Attribute" aria-label="Go to Attribute">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type Attribute interface { <a href="#Qualifier">Qualifier</a> <span id="Attribute.AddQualifier" data-kind="method"> <span class="comment">// AddQualifier adds a qualifier on the Attribute or error if the qualification is not a valid qualifier type.</span> </span> AddQualifier(<a href="#Qualifier">Qualifier</a>) (<a href="#Attribute">Attribute</a>, <a href="/builtin#error">error</a>) <span id="Attribute.Resolve" data-kind="method"> <span class="comment">// Resolve returns the value of the Attribute and whether it was present given an Activation.</span> </span> <span class="comment">// For objects which support safe traversal, the value may be non-nil and the presence flag be false.</span> <span class="comment">//</span> <span class="comment">// If an error is encountered during attribute resolution, it will be returned immediately.</span> <span class="comment">// If the attribute cannot be resolved within the Activation, the result must be: `nil`, `error`</span> <span class="comment">// with the error indicating which variable was missing.</span> Resolve(<a href="#Activation">Activation</a>) (<a href="/builtin#any">any</a>, <a href="/builtin#error">error</a>) }</pre> </div> <p>Attribute values are a variable or value with an optional set of qualifiers, such as field, key, or index accesses. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="AttributeFactory" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L28">AttributeFactory</a> <a class="Documentation-idLink" href="#AttributeFactory" aria-label="Go to AttributeFactory">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type AttributeFactory interface { <span id="AttributeFactory.AbsoluteAttribute" data-kind="method"> <span class="comment">// AbsoluteAttribute creates an attribute that refers to a top-level variable name.</span> </span> <span class="comment">//</span> <span class="comment">// Checked expressions generate absolute attribute with a single name.</span> <span class="comment">// Parse-only expressions may have more than one possible absolute identifier when the</span> <span class="comment">// expression is created within a container, e.g. package or namespace.</span> <span class="comment">//</span> <span class="comment">// When there is more than one name supplied to the AbsoluteAttribute call, the names</span> <span class="comment">// must be in CEL's namespace resolution order. The name arguments provided here are</span> <span class="comment">// returned in the same order as they were provided by the NamespacedAttribute</span> <span class="comment">// CandidateVariableNames method.</span> AbsoluteAttribute(id <a href="/builtin#int64">int64</a>, names ...<a href="/builtin#string">string</a>) <a href="#NamespacedAttribute">NamespacedAttribute</a> <span id="AttributeFactory.ConditionalAttribute" data-kind="method"> <span class="comment">// ConditionalAttribute creates an attribute with two Attribute branches, where the Attribute</span> </span> <span class="comment">// that is resolved depends on the boolean evaluation of the input 'expr'.</span> ConditionalAttribute(id <a href="/builtin#int64">int64</a>, expr <a href="#Interpretable">Interpretable</a>, t, f <a href="#Attribute">Attribute</a>) <a href="#Attribute">Attribute</a> <span id="AttributeFactory.MaybeAttribute" data-kind="method"> <span class="comment">// MaybeAttribute creates an attribute that refers to either a field selection or a namespaced</span> </span> <span class="comment">// variable name.</span> <span class="comment">//</span> <span class="comment">// Only expressions which have not been type-checked may generate oneof attributes.</span> MaybeAttribute(id <a href="/builtin#int64">int64</a>, name <a href="/builtin#string">string</a>) <a href="#Attribute">Attribute</a> <span id="AttributeFactory.RelativeAttribute" data-kind="method"> <span class="comment">// RelativeAttribute creates an attribute whose value is a qualification of a dynamic</span> </span> <span class="comment">// computation rather than a static variable reference.</span> RelativeAttribute(id <a href="/builtin#int64">int64</a>, operand <a href="#Interpretable">Interpretable</a>) <a href="#Attribute">Attribute</a> <span id="AttributeFactory.NewQualifier" data-kind="method"> <span class="comment">// NewQualifier creates a qualifier on the target object with a given value.</span> </span> <span class="comment">//</span> <span class="comment">// The 'val' may be an Attribute or any proto-supported map key type: bool, int, string, uint.</span> <span class="comment">//</span> <span class="comment">// The qualifier may consider the object type being qualified, if present. If absent, the</span> <span class="comment">// qualification should be considered dynamic and the qualification should still work, though</span> <span class="comment">// it may be sub-optimal.</span> NewQualifier(objType *<a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Type">Type</a>, qualID <a href="/builtin#int64">int64</a>, val <a href="/builtin#any">any</a>, opt <a href="/builtin#bool">bool</a>) (<a href="#Qualifier">Qualifier</a>, <a href="/builtin#error">error</a>) }</pre> </div> <p>AttributeFactory provides methods creating Attribute and Qualifier values. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewAttributeFactory" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L144">NewAttributeFactory</a> <a class="Documentation-idLink" href="#NewAttributeFactory" aria-label="Go to NewAttributeFactory">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func NewAttributeFactory(cont *<a href="/github.com/google/cel-go@v0.22.1/common/containers">containers</a>.<a href="/github.com/google/cel-go@v0.22.1/common/containers#Container">Container</a>, a <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Adapter">Adapter</a>, p <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Provider">Provider</a>, opts ...<a href="#AttrFactoryOption">AttrFactoryOption</a>) <a href="#AttributeFactory">AttributeFactory</a></pre> </div> <p>NewAttributeFactory returns a default AttributeFactory which is produces Attribute values capable of resolving types by simple names and qualify the values using the supported qualifier types: bool, int, string, and uint. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewPartialAttributeFactory" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L181">NewPartialAttributeFactory</a> <a class="Documentation-idLink" href="#NewPartialAttributeFactory" aria-label="Go to NewPartialAttributeFactory">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func NewPartialAttributeFactory(container *<a href="/github.com/google/cel-go@v0.22.1/common/containers">containers</a>.<a href="/github.com/google/cel-go@v0.22.1/common/containers#Container">Container</a>, adapter <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Adapter">Adapter</a>, provider <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Provider">Provider</a>, opts ...<a href="#AttrFactoryOption">AttrFactoryOption</a>) <a href="#AttributeFactory">AttributeFactory</a></pre> </div> <p>NewPartialAttributeFactory returns an AttributeFactory implementation capable of performing AttributePattern matches with PartialActivation inputs. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="AttributePattern" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L47">AttributePattern</a> <a class="Documentation-idLink" href="#AttributePattern" aria-label="Go to AttributePattern">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type AttributePattern struct { <span class="comment">// contains filtered or unexported fields</span> }</pre> </div> <p>AttributePattern represents a top-level variable with an optional set of qualifier patterns. </p><p>When using a CEL expression within a container, e.g. a package or namespace, the variable name in the pattern must match the qualified name produced during the variable namespace resolution. For example, if variable `c` appears in an expression whose container is `a.b`, the variable name supplied to the pattern must be `a.b.c` </p><p>The qualifier patterns for attribute matching must be one of the following: </p><ul class="Documentation-bulletList"> <li>valid map key type: string, int, uint, bool</li> <li>wildcard (*)</li> </ul><p>Examples: </p><ol class="Documentation-numberList"> <li value="1">ns.myvar["complex-value"]</li> <li value="2">ns.myvar["complex-value"][0]</li> <li value="3">ns.myvar["complex-value"].*.name</li> </ol><p>The first example is simple: match an attribute where the variable is 'ns.myvar' with a field access on 'complex-value'. The second example expands the match to indicate that only a specific index `0` should match. And lastly, the third example matches any indexed access that later selects the 'name' field. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewAttributePattern" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L53">NewAttributePattern</a> <a class="Documentation-idLink" href="#NewAttributePattern" aria-label="Go to NewAttributePattern">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func NewAttributePattern(variable <a href="/builtin#string">string</a>) *<a href="#AttributePattern">AttributePattern</a></pre> </div> <p>NewAttributePattern produces a new mutable AttributePattern based on a variable name. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributePattern.QualBool" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributePattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L84">QualBool</a> <a class="Documentation-idLink" href="#AttributePattern.QualBool" aria-label="Go to AttributePattern.QualBool">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (apat *<a href="#AttributePattern">AttributePattern</a>) QualBool(pattern <a href="/builtin#bool">bool</a>) *<a href="#AttributePattern">AttributePattern</a></pre> </div> <p>QualBool adds a bool qualifier pattern for a map index operation to the AttributePattern. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributePattern.QualInt" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributePattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L70">QualInt</a> <a class="Documentation-idLink" href="#AttributePattern.QualInt" aria-label="Go to AttributePattern.QualInt">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (apat *<a href="#AttributePattern">AttributePattern</a>) QualInt(pattern <a href="/builtin#int64">int64</a>) *<a href="#AttributePattern">AttributePattern</a></pre> </div> <p>QualInt adds an int qualifier pattern to the AttributePattern. The index may be either a map or list index. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributePattern.QualString" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributePattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L62">QualString</a> <a class="Documentation-idLink" href="#AttributePattern.QualString" aria-label="Go to AttributePattern.QualString">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (apat *<a href="#AttributePattern">AttributePattern</a>) QualString(pattern <a href="/builtin#string">string</a>) *<a href="#AttributePattern">AttributePattern</a></pre> </div> <p>QualString adds a string qualifier pattern to the AttributePattern. The string may be a valid identifier, or string map key including empty string. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributePattern.QualUint" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributePattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L77">QualUint</a> <a class="Documentation-idLink" href="#AttributePattern.QualUint" aria-label="Go to AttributePattern.QualUint">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (apat *<a href="#AttributePattern">AttributePattern</a>) QualUint(pattern <a href="/builtin#uint64">uint64</a>) *<a href="#AttributePattern">AttributePattern</a></pre> </div> <p>QualUint adds an uint qualifier pattern for a map index operation to the AttributePattern. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributePattern.QualifierPatterns" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributePattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L104">QualifierPatterns</a> <a class="Documentation-idLink" href="#AttributePattern.QualifierPatterns" aria-label="Go to AttributePattern.QualifierPatterns">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (apat *<a href="#AttributePattern">AttributePattern</a>) QualifierPatterns() []*<a href="#AttributeQualifierPattern">AttributeQualifierPattern</a></pre> </div> <p>QualifierPatterns returns the set of AttributeQualifierPattern values on the AttributePattern. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributePattern.VariableMatches" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributePattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L99">VariableMatches</a> <a class="Documentation-idLink" href="#AttributePattern.VariableMatches" aria-label="Go to AttributePattern.VariableMatches">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (apat *<a href="#AttributePattern">AttributePattern</a>) VariableMatches(variable <a href="/builtin#string">string</a>) <a href="/builtin#bool">bool</a></pre> </div> <p>VariableMatches returns true if the fully qualified variable matches the AttributePattern fully qualified variable name. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributePattern.Wildcard" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributePattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L91">Wildcard</a> <a class="Documentation-idLink" href="#AttributePattern.Wildcard" aria-label="Go to AttributePattern.Wildcard">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (apat *<a href="#AttributePattern">AttributePattern</a>) Wildcard() *<a href="#AttributePattern">AttributePattern</a></pre> </div> <p>Wildcard adds a special sentinel qualifier pattern that will match any single qualifier. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="AttributeQualifierPattern" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L109">AttributeQualifierPattern</a> <a class="Documentation-idLink" href="#AttributeQualifierPattern" aria-label="Go to AttributeQualifierPattern">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type AttributeQualifierPattern struct { <span class="comment">// contains filtered or unexported fields</span> }</pre> </div> <p>AttributeQualifierPattern holds a wildcard or valued qualifier pattern. </p> <div class="Documentation-typeMethod"> <h4 tabindex="-1" id="AttributeQualifierPattern.Matches" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*AttributeQualifierPattern) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go#L116">Matches</a> <a class="Documentation-idLink" href="#AttributeQualifierPattern.Matches" aria-label="Go to AttributeQualifierPattern.Matches">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (qpat *<a href="#AttributeQualifierPattern">AttributeQualifierPattern</a>) Matches(q <a href="#Qualifier">Qualifier</a>) <a href="/builtin#bool">bool</a></pre> </div> <p>Matches returns true if the qualifier pattern is a wildcard, or the Qualifier implements the qualifierValueEquator interface and its IsValueEqualTo returns true for the qualifier pattern. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="CancellationCause" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L65">CancellationCause</a> <a class="Documentation-idLink" href="#CancellationCause" aria-label="Go to CancellationCause">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type CancellationCause <a href="/builtin#int">int</a></pre> </div> <p>CancellationCause enumerates the ways a program evaluation operation can be cancelled. </p> <div class="Documentation-typeConstant"> <div class="Documentation-declaration"> <pre>const ( <span id="ContextCancelled" data-kind="constant"> <span class="comment">// ContextCancelled indicates that the operation was cancelled in response to a Golang context cancellation.</span> </span> ContextCancelled <a href="#CancellationCause">CancellationCause</a> = <a href="/builtin#iota">iota</a> <span id="CostLimitExceeded" data-kind="constant"> <span class="comment">// CostLimitExceeded indicates that the operation was cancelled in response to the actual cost limit being</span> </span> <span class="comment">// exceeded.</span> CostLimitExceeded )</pre> </div> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="ConstantQualifier" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L92">ConstantQualifier</a> <a class="Documentation-idLink" href="#ConstantQualifier" aria-label="Go to ConstantQualifier">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.6.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type ConstantQualifier interface { <a href="#Qualifier">Qualifier</a> <span id="ConstantQualifier.Value" data-kind="method"> <span class="comment">// Value returns the constant value associated with the qualifier.</span> </span> Value() <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a> }</pre> </div> <p>ConstantQualifier interface embeds the Qualifier interface and provides an option to inspect the qualifier's constant value. </p><p>Non-constant qualifiers are of Attribute type. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="CostTracker" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L163">CostTracker</a> <a class="Documentation-idLink" href="#CostTracker" aria-label="Go to CostTracker">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type CostTracker struct { <span id="CostTracker.Estimator" data-kind="field"> Estimator <a href="#ActualCostEstimator">ActualCostEstimator</a> </span> <span id="CostTracker.Limit" data-kind="field"> Limit *<a href="/builtin#uint64">uint64</a> </span> <span class="comment">// contains filtered or unexported fields</span> }</pre> </div> <p>CostTracker represents the information needed for tracking runtime cost. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewCostTracker" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L133">NewCostTracker</a> <a class="Documentation-idLink" href="#NewCostTracker" aria-label="Go to NewCostTracker">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.16.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func NewCostTracker(estimator <a href="#ActualCostEstimator">ActualCostEstimator</a>, opts ...<a href="#CostTrackerOption">CostTrackerOption</a>) (*<a href="#CostTracker">CostTracker</a>, <a href="/builtin#error">error</a>)</pre> </div> <p>NewCostTracker creates a new CostTracker with a given estimator and a set of functional CostTrackerOption values. </p> </div><div class="Documentation-typeMethod"> <h4 tabindex="-1" id="CostTracker.ActualCost" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (*CostTracker) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L174">ActualCost</a> <a class="Documentation-idLink" href="#CostTracker.ActualCost" aria-label="Go to CostTracker.ActualCost">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (c *<a href="#CostTracker">CostTracker</a>) ActualCost() <a href="/builtin#uint64">uint64</a></pre> </div> <p>ActualCost returns the runtime cost </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="CostTrackerOption" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L112">CostTrackerOption</a> <a class="Documentation-idLink" href="#CostTrackerOption" aria-label="Go to CostTrackerOption">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.16.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type CostTrackerOption func(*<a href="#CostTracker">CostTracker</a>) <a href="/builtin#error">error</a></pre> </div> <p>CostTrackerOption configures the behavior of CostTracker objects. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="CostTrackerLimit" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L116">CostTrackerLimit</a> <a class="Documentation-idLink" href="#CostTrackerLimit" aria-label="Go to CostTrackerLimit">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.16.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func CostTrackerLimit(limit <a href="/builtin#uint64">uint64</a>) <a href="#CostTrackerOption">CostTrackerOption</a></pre> </div> <p>CostTrackerLimit sets the runtime limit on the evaluation cost during execution and will terminate the expression evaluation if the limit is exceeded. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="OverloadCostTracker" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L152">OverloadCostTracker</a> <a class="Documentation-idLink" href="#OverloadCostTracker" aria-label="Go to OverloadCostTracker">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.17.7</span> </span> </h4> <div class="Documentation-declaration"> <pre>func OverloadCostTracker(overloadID <a href="/builtin#string">string</a>, fnTracker <a href="#FunctionTracker">FunctionTracker</a>) <a href="#CostTrackerOption">CostTrackerOption</a></pre> </div> <p>OverloadCostTracker binds an overload ID to a runtime FunctionTracker implementation. </p><p>OverloadCostTracker instances augment or override ActualCostEstimator decisions, allowing for versioned and/or optional cost tracking changes. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="PresenceTestHasCost" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L125">PresenceTestHasCost</a> <a class="Documentation-idLink" href="#PresenceTestHasCost" aria-label="Go to PresenceTestHasCost">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.16.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func PresenceTestHasCost(hasCost <a href="/builtin#bool">bool</a>) <a href="#CostTrackerOption">CostTrackerOption</a></pre> </div> <p>PresenceTestHasCost determines whether presence testing has a cost of one or zero. Defaults to presence test has a cost of one. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="Dispatcher" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/dispatcher.go#L24">Dispatcher</a> <a class="Documentation-idLink" href="#Dispatcher" aria-label="Go to Dispatcher">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>type Dispatcher interface { <span id="Dispatcher.Add" data-kind="method"> <span class="comment">// Add one or more overloads, returning an error if any Overload has the same Overload#Name.</span> </span> Add(overloads ...*<a href="/github.com/google/cel-go@v0.22.1/common/functions">functions</a>.<a href="/github.com/google/cel-go@v0.22.1/common/functions#Overload">Overload</a>) <a href="/builtin#error">error</a> <span id="Dispatcher.FindOverload" data-kind="method"> <span class="comment">// FindOverload returns an Overload definition matching the provided name.</span> </span> FindOverload(overload <a href="/builtin#string">string</a>) (*<a href="/github.com/google/cel-go@v0.22.1/common/functions">functions</a>.<a href="/github.com/google/cel-go@v0.22.1/common/functions#Overload">Overload</a>, <a href="/builtin#bool">bool</a>) <span id="Dispatcher.OverloadIds" data-kind="method"> <span class="comment">// OverloadIds returns the set of all overload identifiers configured for dispatch.</span> </span> OverloadIds() []<a href="/builtin#string">string</a> }</pre> </div> <p>Dispatcher resolves function calls to their appropriate overload. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="ExtendDispatcher" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/dispatcher.go#L44">ExtendDispatcher</a> <a class="Documentation-idLink" href="#ExtendDispatcher" aria-label="Go to ExtendDispatcher">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func ExtendDispatcher(parent <a href="#Dispatcher">Dispatcher</a>) <a href="#Dispatcher">Dispatcher</a></pre> </div> <p>ExtendDispatcher returns a Dispatcher which inherits the overloads of its parent, and provides an isolation layer between built-ins and extension functions which is useful for forward compatibility. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewDispatcher" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/dispatcher.go#L36">NewDispatcher</a> <a class="Documentation-idLink" href="#NewDispatcher" aria-label="Go to NewDispatcher">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func NewDispatcher() <a href="#Dispatcher">Dispatcher</a></pre> </div> <p>NewDispatcher returns an empty Dispatcher instance. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="EvalCancelledError" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L54">EvalCancelledError</a> <a class="Documentation-idLink" href="#EvalCancelledError" aria-label="Go to EvalCancelledError">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type EvalCancelledError struct { <span id="EvalCancelledError.Message" data-kind="field"> Message <a href="/builtin#string">string</a> </span><span id="EvalCancelledError.Cause" data-kind="field"> <span class="comment">// Type identifies the cause of the cancellation.</span> </span> Cause <a href="#CancellationCause">CancellationCause</a> }</pre> </div> <p>EvalCancelledError represents a cancelled program evaluation operation. </p> <div class="Documentation-typeMethod"> <h4 tabindex="-1" id="EvalCancelledError.Error" data-kind="method" class="Documentation-typeMethodHeader"> <span>func (EvalCancelledError) <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L60">Error</a> <a class="Documentation-idLink" href="#EvalCancelledError.Error" aria-label="Go to EvalCancelledError.Error">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func (e <a href="#EvalCancelledError">EvalCancelledError</a>) Error() <a href="/builtin#string">string</a></pre> </div> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="EvalObserver" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L37">EvalObserver</a> <a class="Documentation-idLink" href="#EvalObserver" aria-label="Go to EvalObserver">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type EvalObserver func(id <a href="/builtin#int64">int64</a>, programStep <a href="/builtin#any">any</a>, value <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>)</pre> </div> <p>EvalObserver is a functional interface that accepts an expression id and an observed value. The id identifies the expression that was evaluated, the programStep is the Interpretable or Qualifier that was evaluated and value is the result of the evaluation. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="CostObserver" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L38">CostObserver</a> <a class="Documentation-idLink" href="#CostObserver" aria-label="Go to CostObserver">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func CostObserver(tracker *<a href="#CostTracker">CostTracker</a>) <a href="#EvalObserver">EvalObserver</a></pre> </div> <p>CostObserver provides an observer that tracks runtime cost. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="EvalStateObserver" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L91">EvalStateObserver</a> <a class="Documentation-idLink" href="#EvalStateObserver" aria-label="Go to EvalStateObserver">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func EvalStateObserver(state <a href="#EvalState">EvalState</a>) <a href="#EvalObserver">EvalObserver</a></pre> </div> <p>EvalStateObserver provides an observer which records the value associated with the given expression id. EvalState must be provided to the observer. This decorator is not thread-safe, and the EvalState must be reset between Eval() calls. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="EvalState" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/evalstate.go#L22">EvalState</a> <a class="Documentation-idLink" href="#EvalState" aria-label="Go to EvalState">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>type EvalState interface { <span id="EvalState.IDs" data-kind="method"> <span class="comment">// IDs returns the list of ids with recorded values.</span> </span> IDs() []<a href="/builtin#int64">int64</a> <span id="EvalState.Value" data-kind="method"> <span class="comment">// Value returns the observed value of the given expression id if found, and a nil false</span> </span> <span class="comment">// result if not.</span> Value(<a href="/builtin#int64">int64</a>) (<a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>, <a href="/builtin#bool">bool</a>) <span id="EvalState.SetValue" data-kind="method"> <span class="comment">// SetValue sets the observed value of the expression id.</span> </span> SetValue(<a href="/builtin#int64">int64</a>, <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>) <span id="EvalState.Reset" data-kind="method"> <span class="comment">// Reset clears the previously recorded expression values.</span> </span> Reset() }</pre> </div> <p>EvalState tracks the values associated with expression ids during execution. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewEvalState" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/evalstate.go#L44">NewEvalState</a> <a class="Documentation-idLink" href="#NewEvalState" aria-label="Go to NewEvalState">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func NewEvalState() <a href="#EvalState">EvalState</a></pre> </div> <p>NewEvalState returns an EvalState instanced used to observe the intermediate evaluations of an expression. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="FunctionTracker" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go#L160">FunctionTracker</a> <a class="Documentation-idLink" href="#FunctionTracker" aria-label="Go to FunctionTracker">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.17.7</span> </span> </h4> <div class="Documentation-declaration"> <pre>type FunctionTracker func(args []<a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>, result <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>) *<a href="/builtin#uint64">uint64</a></pre> </div> <p>FunctionTracker computes the actual cost of evaluating the functions with the given arguments and result. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="Interpretable" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go#L32">Interpretable</a> <a class="Documentation-idLink" href="#Interpretable" aria-label="Go to Interpretable">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>type Interpretable interface { <span id="Interpretable.ID" data-kind="method"> <span class="comment">// ID value corresponding to the expression node.</span> </span> ID() <a href="/builtin#int64">int64</a> <span id="Interpretable.Eval" data-kind="method"> <span class="comment">// Eval an Activation to produce an output.</span> </span> Eval(activation <a href="#Activation">Activation</a>) <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a> }</pre> </div> <p>Interpretable can accept a given Activation and produce a value along with an accompanying EvalState which can be used to inspect whether additional data might be necessary to complete the evaluation. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="InterpretableAttribute" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go#L49">InterpretableAttribute</a> <a class="Documentation-idLink" href="#InterpretableAttribute" aria-label="Go to InterpretableAttribute">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.6.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type InterpretableAttribute interface { <a href="#Interpretable">Interpretable</a> <span id="InterpretableAttribute.Attr" data-kind="method"> <span class="comment">// Attr returns the Attribute value.</span> </span> Attr() <a href="#Attribute">Attribute</a> <span id="InterpretableAttribute.Adapter" data-kind="method"> <span class="comment">// Adapter returns the type adapter to be used for adapting resolved Attribute values.</span> </span> Adapter() <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Adapter">Adapter</a> <span id="InterpretableAttribute.AddQualifier" data-kind="method"> <span class="comment">// AddQualifier proxies the Attribute.AddQualifier method.</span> </span> <span class="comment">//</span> <span class="comment">// Note, this method may mutate the current attribute state. If the desire is to clone the</span> <span class="comment">// Attribute, the Attribute should first be copied before adding the qualifier. Attributes</span> <span class="comment">// are not copyable by default, so this is a capable that would need to be added to the</span> <span class="comment">// AttributeFactory or specifically to the underlying Attribute implementation.</span> AddQualifier(<a href="#Qualifier">Qualifier</a>) (<a href="#Attribute">Attribute</a>, <a href="/builtin#error">error</a>) <span id="InterpretableAttribute.Qualify" data-kind="method"> <span class="comment">// Qualify replicates the Attribute.Qualify method to permit extension and interception</span> </span> <span class="comment">// of object qualification.</span> Qualify(vars <a href="#Activation">Activation</a>, obj <a href="/builtin#any">any</a>) (<a href="/builtin#any">any</a>, <a href="/builtin#error">error</a>) <span id="InterpretableAttribute.QualifyIfPresent" data-kind="method"> <span class="comment">// QualifyIfPresent qualifies the object if the qualifier is declared or defined on the object.</span> </span> <span class="comment">// The 'presenceOnly' flag indicates that the value is not necessary, just a boolean status as</span> <span class="comment">// to whether the qualifier is present.</span> QualifyIfPresent(vars <a href="#Activation">Activation</a>, obj <a href="/builtin#any">any</a>, presenceOnly <a href="/builtin#bool">bool</a>) (<a href="/builtin#any">any</a>, <a href="/builtin#bool">bool</a>, <a href="/builtin#error">error</a>) <span id="InterpretableAttribute.IsOptional" data-kind="method"> <span class="comment">// IsOptional indicates whether the resulting value is an optional type.</span> </span> IsOptional() <a href="/builtin#bool">bool</a> <span id="InterpretableAttribute.Resolve" data-kind="method"> <span class="comment">// Resolve returns the value of the Attribute given the current Activation.</span> </span> Resolve(<a href="#Activation">Activation</a>) (<a href="/builtin#any">any</a>, <a href="/builtin#error">error</a>) }</pre> </div> <p>InterpretableAttribute interface for tracking whether the Interpretable is an attribute. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="InterpretableCall" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go#L83">InterpretableCall</a> <a class="Documentation-idLink" href="#InterpretableCall" aria-label="Go to InterpretableCall">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.6.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type InterpretableCall interface { <a href="#Interpretable">Interpretable</a> <span id="InterpretableCall.Function" data-kind="method"> <span class="comment">// Function returns the function name as it appears in text or mangled operator name as it</span> </span> <span class="comment">// appears in the operators.go file.</span> Function() <a href="/builtin#string">string</a> <span id="InterpretableCall.OverloadID" data-kind="method"> <span class="comment">// OverloadID returns the overload id associated with the function specialization.</span> </span> <span class="comment">// Overload ids are stable across language boundaries and can be treated as synonymous with a</span> <span class="comment">// unique function signature.</span> OverloadID() <a href="/builtin#string">string</a> <span id="InterpretableCall.Args" data-kind="method"> <span class="comment">// Args returns the normalized arguments to the function overload.</span> </span> <span class="comment">// For receiver-style functions, the receiver target is arg 0.</span> Args() []<a href="#Interpretable">Interpretable</a> }</pre> </div> <p>InterpretableCall interface for inspecting Interpretable instructions related to function calls. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewCall" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go#L521">NewCall</a> <a class="Documentation-idLink" href="#NewCall" aria-label="Go to NewCall">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func NewCall(id <a href="/builtin#int64">int64</a>, function, overload <a href="/builtin#string">string</a>, args []<a href="#Interpretable">Interpretable</a>, impl <a href="/github.com/google/cel-go@v0.22.1/common/functions">functions</a>.<a href="/github.com/google/cel-go@v0.22.1/common/functions#FunctionOp">FunctionOp</a>) <a href="#InterpretableCall">InterpretableCall</a></pre> </div> <p>NewCall creates a new call Interpretable. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="InterpretableConst" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go#L41">InterpretableConst</a> <a class="Documentation-idLink" href="#InterpretableConst" aria-label="Go to InterpretableConst">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.6.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type InterpretableConst interface { <a href="#Interpretable">Interpretable</a> <span id="InterpretableConst.Value" data-kind="method"> <span class="comment">// Value returns the constant value of the instruction.</span> </span> Value() <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a> }</pre> </div> <p>InterpretableConst interface for tracking whether the Interpretable is a constant value. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewConstValue" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go#L178">NewConstValue</a> <a class="Documentation-idLink" href="#NewConstValue" aria-label="Go to NewConstValue">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.6.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func NewConstValue(id <a href="/builtin#int64">int64</a>, val <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Val">Val</a>) <a href="#InterpretableConst">InterpretableConst</a></pre> </div> <p>NewConstValue creates a new constant valued Interpretable. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="InterpretableConstructor" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go#L102">InterpretableConstructor</a> <a class="Documentation-idLink" href="#InterpretableConstructor" aria-label="Go to InterpretableConstructor">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type InterpretableConstructor interface { <a href="#Interpretable">Interpretable</a> <span id="InterpretableConstructor.InitVals" data-kind="method"> <span class="comment">// InitVals returns all the list elements, map key and values or struct field values.</span> </span> InitVals() []<a href="#Interpretable">Interpretable</a> <span id="InterpretableConstructor.Type" data-kind="method"> <span class="comment">// Type returns the type constructed.</span> </span> Type() <a href="/github.com/google/cel-go@v0.22.1/common/types/ref">ref</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types/ref#Type">Type</a> }</pre> </div> <p>InterpretableConstructor interface for inspecting Interpretable instructions that initialize a list, map or struct. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="InterpretableDecorator" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/decorators.go#L26">InterpretableDecorator</a> <a class="Documentation-idLink" href="#InterpretableDecorator" aria-label="Go to InterpretableDecorator">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>type InterpretableDecorator func(<a href="#Interpretable">Interpretable</a>) (<a href="#Interpretable">Interpretable</a>, <a href="/builtin#error">error</a>)</pre> </div> <p>InterpretableDecorator is a functional interface for decorating or replacing Interpretable expression nodes at construction time. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="CompileRegexConstants" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L145">CompileRegexConstants</a> <a class="Documentation-idLink" href="#CompileRegexConstants" aria-label="Go to CompileRegexConstants">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func CompileRegexConstants(regexOptimizations ...*<a href="#RegexOptimization">RegexOptimization</a>) <a href="#InterpretableDecorator">InterpretableDecorator</a></pre> </div> <p>CompileRegexConstants compiles regex pattern string constants at program creation time and reports any regex pattern compile errors. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="ExhaustiveEval" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L102">ExhaustiveEval</a> <a class="Documentation-idLink" href="#ExhaustiveEval" aria-label="Go to ExhaustiveEval">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func ExhaustiveEval() <a href="#InterpretableDecorator">InterpretableDecorator</a></pre> </div> <p>ExhaustiveEval replaces operations that short-circuit with versions that evaluate expressions and couples this behavior with the TrackState() decorator to provide insight into the evaluation state of the entire expression. EvalState must be provided to the decorator. This decorator is not thread-safe, and the EvalState must be reset between Eval() calls. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="InterruptableEval" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L114">InterruptableEval</a> <a class="Documentation-idLink" href="#InterruptableEval" aria-label="Go to InterruptableEval">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func InterruptableEval() <a href="#InterpretableDecorator">InterpretableDecorator</a></pre> </div> <p>InterruptableEval annotates comprehension loops with information that indicates they should check the `#interrupted` state within a custom Activation. </p><p>The custom activation is currently managed higher up in the stack within the 'cel' package and should not require any custom support on behalf of callers. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="Observe" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L41">Observe</a> <a class="Documentation-idLink" href="#Observe" aria-label="Go to Observe">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func Observe(observers ...<a href="#EvalObserver">EvalObserver</a>) <a href="#InterpretableDecorator">InterpretableDecorator</a></pre> </div> <p>Observe constructs a decorator that calls all the provided observers in order after evaluating each Interpretable or Qualifier during program evaluation. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="Optimize" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L120">Optimize</a> <a class="Documentation-idLink" href="#Optimize" aria-label="Go to Optimize">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.3.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func Optimize() <a href="#InterpretableDecorator">InterpretableDecorator</a></pre> </div> <p>Optimize will pre-compute operations such as list and map construction and optimize call arguments to set membership tests. The set of optimizations will increase over time. </p> </div><div class="Documentation-typeFunc"> <h4 tabindex="-1" id="TrackState" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L83">TrackState</a> <a class="Documentation-idLink" href="#TrackState" aria-label="Go to TrackState">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func TrackState(state <a href="#EvalState">EvalState</a>) <a href="#InterpretableDecorator">InterpretableDecorator</a></pre> </div> <p>TrackState decorates each expression node with an observer which records the value associated with the given expression id. EvalState must be provided to the decorator. This decorator is not thread-safe, and the EvalState must be reset between Eval() calls. DEPRECATED: Please use EvalStateObserver instead. It composes gracefully with additional observers. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="Interpreter" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L28">Interpreter</a> <a class="Documentation-idLink" href="#Interpreter" aria-label="Go to Interpreter">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>type Interpreter interface { <span id="Interpreter.NewInterpretable" data-kind="method"> <span class="comment">// NewInterpretable creates an Interpretable from a checked expression and an</span> </span> <span class="comment">// optional list of InterpretableDecorator values.</span> NewInterpretable(exprAST *<a href="/github.com/google/cel-go@v0.22.1/common/ast">ast</a>.<a href="/github.com/google/cel-go@v0.22.1/common/ast#AST">AST</a>, decorators ...<a href="#InterpretableDecorator">InterpretableDecorator</a>) (<a href="#Interpretable">Interpretable</a>, <a href="/builtin#error">error</a>) }</pre> </div> <p>Interpreter generates a new Interpretable from a checked or unchecked expression. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewInterpreter" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L159">NewInterpreter</a> <a class="Documentation-idLink" href="#NewInterpreter" aria-label="Go to NewInterpreter">露</a></span> <span class="Documentation-sinceVersion"> </span> </h4> <div class="Documentation-declaration"> <pre>func NewInterpreter(dispatcher <a href="#Dispatcher">Dispatcher</a>, container *<a href="/github.com/google/cel-go@v0.22.1/common/containers">containers</a>.<a href="/github.com/google/cel-go@v0.22.1/common/containers#Container">Container</a>, provider <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Provider">Provider</a>, adapter <a href="/github.com/google/cel-go@v0.22.1/common/types">types</a>.<a href="/github.com/google/cel-go@v0.22.1/common/types#Adapter">Adapter</a>, attrFactory <a href="#AttributeFactory">AttributeFactory</a>) <a href="#Interpreter">Interpreter</a></pre> </div> <p>NewInterpreter builds an Interpreter from a Dispatcher and TypeProvider which will be used throughout the Eval of all Interpretable instances generated from it. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="NamespacedAttribute" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L118">NamespacedAttribute</a> <a class="Documentation-idLink" href="#NamespacedAttribute" aria-label="Go to NamespacedAttribute">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type NamespacedAttribute interface { <a href="#Attribute">Attribute</a> <span id="NamespacedAttribute.CandidateVariableNames" data-kind="method"> <span class="comment">// CandidateVariableNames returns the possible namespaced variable names for this Attribute in</span> </span> <span class="comment">// the CEL namespace resolution order.</span> CandidateVariableNames() []<a href="/builtin#string">string</a> <span id="NamespacedAttribute.Qualifiers" data-kind="method"> <span class="comment">// Qualifiers returns the list of qualifiers associated with the Attribute.</span> </span> Qualifiers() []<a href="#Qualifier">Qualifier</a> }</pre> </div> <p>NamespacedAttribute values are a variable within a namespace, and an optional set of qualifiers such as field, key, or index accesses. </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="PartialActivation" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/activation.go#L151">PartialActivation</a> <a class="Documentation-idLink" href="#PartialActivation" aria-label="Go to PartialActivation">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type PartialActivation interface { <a href="#Activation">Activation</a> <span id="PartialActivation.UnknownAttributePatterns" data-kind="method"> <span class="comment">// UnknownAttributePaths returns a set of AttributePattern values which match Attribute</span> </span> <span class="comment">// expressions for data accesses whose values are not yet known.</span> UnknownAttributePatterns() []*<a href="#AttributePattern">AttributePattern</a> }</pre> </div> <p>PartialActivation extends the Activation interface with a set of UnknownAttributePatterns. </p> <div class="Documentation-typeFunc"> <h4 tabindex="-1" id="NewPartialActivation" data-kind="function" class="Documentation-typeFuncHeader"> <span>func <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/activation.go#L141">NewPartialActivation</a> <a class="Documentation-idLink" href="#NewPartialActivation" aria-label="Go to NewPartialActivation">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>func NewPartialActivation(bindings <a href="/builtin#any">any</a>, unknowns ...*<a href="#AttributePattern">AttributePattern</a>) (<a href="#PartialActivation">PartialActivation</a>, <a href="/builtin#error">error</a>)</pre> </div> <p>NewPartialActivation returns an Activation which contains a list of AttributePattern values representing field and index operations that should result in a 'types.Unknown' result. </p><p>The `bindings` value may be any value type supported by the interpreter.NewActivation call, but is typically either an existing Activation or map[string]any. </p> </div> </div><div class="Documentation-type"> <h4 tabindex="-1" id="Qualifier" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go#L67">Qualifier</a> <a class="Documentation-idLink" href="#Qualifier" aria-label="Go to Qualifier">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.4.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type Qualifier interface { <span id="Qualifier.ID" data-kind="method"> <span class="comment">// ID where the qualifier appears within an expression.</span> </span> ID() <a href="/builtin#int64">int64</a> <span id="Qualifier.IsOptional" data-kind="method"> <span class="comment">// IsOptional specifies whether the qualifier is optional.</span> </span> <span class="comment">// Instead of a direct qualification, an optional qualifier will be resolved via QualifyIfPresent</span> <span class="comment">// rather than Qualify. A non-optional qualifier may also be resolved through QualifyIfPresent if</span> <span class="comment">// the object to qualify is itself optional.</span> IsOptional() <a href="/builtin#bool">bool</a> <span id="Qualifier.Qualify" data-kind="method"> <span class="comment">// Qualify performs a qualification, e.g. field selection, on the input object and returns</span> </span> <span class="comment">// the value of the access and whether the value was set. A non-nil value with a false presence</span> <span class="comment">// test result indicates that the value being returned is the default value.</span> Qualify(vars <a href="#Activation">Activation</a>, obj <a href="/builtin#any">any</a>) (<a href="/builtin#any">any</a>, <a href="/builtin#error">error</a>) <span id="Qualifier.QualifyIfPresent" data-kind="method"> <span class="comment">// QualifyIfPresent qualifies the object if the qualifier is declared or defined on the object.</span> </span> <span class="comment">// The 'presenceOnly' flag indicates that the value is not necessary, just a boolean status as</span> <span class="comment">// to whether the qualifier is present.</span> QualifyIfPresent(vars <a href="#Activation">Activation</a>, obj <a href="/builtin#any">any</a>, presenceOnly <a href="/builtin#bool">bool</a>) (<a href="/builtin#any">any</a>, <a href="/builtin#bool">bool</a>, <a href="/builtin#error">error</a>) }</pre> </div> <p>Qualifier marker interface for designating different qualifier values and where they appear within field selections and index call expressions (`_[_]`). </p> </div><div class="Documentation-type"> <h4 tabindex="-1" id="RegexOptimization" data-kind="type" class="Documentation-typeHeader"> <span>type <a class="Documentation-source" href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go#L128">RegexOptimization</a> <a class="Documentation-idLink" href="#RegexOptimization" aria-label="Go to RegexOptimization">露</a></span> <span class="Documentation-sinceVersion"> <span class="Documentation-sinceVersionLabel">added in</span> <span class="Documentation-sinceVersionVersion">v0.10.0</span> </span> </h4> <div class="Documentation-declaration"> <pre>type RegexOptimization struct { <span id="RegexOptimization.Function" data-kind="field"> <span class="comment">// Function is the name of the function to optimize.</span> </span> Function <a href="/builtin#string">string</a> <span id="RegexOptimization.OverloadID" data-kind="field"> <span class="comment">// OverloadID is the ID of the overload to optimize.</span> </span> OverloadID <a href="/builtin#string">string</a> <span id="RegexOptimization.RegexIndex" data-kind="field"> <span class="comment">// RegexIndex is the index position of the regex pattern argument. Only calls to the function where this argument is</span> </span> <span class="comment">// a string constant will be delegated to this optimizer.</span> RegexIndex <a href="/builtin#int">int</a> <span id="RegexOptimization.Factory" data-kind="field"> <span class="comment">// Factory constructs a replacement InterpretableCall node that optimizes the regex function call. Factory is</span> </span> <span class="comment">// provided with the unoptimized regex call and the string constant at the RegexIndex argument.</span> <span class="comment">// The Factory may compile the regex for use across all invocations of the call, return any errors and</span> <span class="comment">// return an interpreter.NewCall with the desired regex optimized function impl.</span> Factory func(call <a href="#InterpretableCall">InterpretableCall</a>, regexPattern <a href="/builtin#string">string</a>) (<a href="#InterpretableCall">InterpretableCall</a>, <a href="/builtin#error">error</a>) }</pre> </div> <p>RegexOptimization provides a way to replace an InterpretableCall for a regex function when the RegexIndex argument is a string constant. Typically, the Factory would compile the regex pattern at RegexIndex and report any errors (at program creation time) and then use the compiled regex for all regex function invocations. </p> </div></section></div> </div> </div> <div class="UnitFiles js-unitFiles"> <h2 class="UnitFiles-title" id="section-sourcefiles"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/insert_drive_file_gm_grey_24dp.svg" alt=""> Source Files <a class="UnitFiles-idLink" href="#section-sourcefiles" aria-label="Go to Source Files">露</a> </h2> <div class="UnitFiles-titleLink"> <a href="https://github.com/google/cel-go/tree/v0.22.1/interpreter" target="_blank" rel="noopener">View all Source files</a> </div> <div> <ul class="UnitFiles-fileList"><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/activation.go" target="_blank" rel="noopener" title="activation.go">activation.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attribute_patterns.go" target="_blank" rel="noopener" title="attribute_patterns.go">attribute_patterns.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/attributes.go" target="_blank" rel="noopener" title="attributes.go">attributes.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/decorators.go" target="_blank" rel="noopener" title="decorators.go">decorators.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/dispatcher.go" target="_blank" rel="noopener" title="dispatcher.go">dispatcher.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/evalstate.go" target="_blank" rel="noopener" title="evalstate.go">evalstate.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpretable.go" target="_blank" rel="noopener" title="interpretable.go">interpretable.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/interpreter.go" target="_blank" rel="noopener" title="interpreter.go">interpreter.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/optimizations.go" target="_blank" rel="noopener" title="optimizations.go">optimizations.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/planner.go" target="_blank" rel="noopener" title="planner.go">planner.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/prune.go" target="_blank" rel="noopener" title="prune.go">prune.go</a> </li><li> <a href="https://github.com/google/cel-go/blob/v0.22.1/interpreter/runtimecost.go" target="_blank" rel="noopener" title="runtimecost.go">runtimecost.go</a> </li></ul> </div> </div> <div class="UnitDirectories js-unitDirectories"> <h2 class="UnitDirectories-title" id="section-directories"> <img class="go-Icon" height="24" width="24" src="/static/shared/icon/folder_gm_grey_24dp.svg" alt=""> Directories <a class="UnitDirectories-idLink" href="#section-directories" aria-label="Go to Directories">露</a> </h2> <div class="UnitDirectories-toggles"> <div class="UnitDirectories-toggleButtons"> <button class="js-showInternalDirectories" data-test-id="internal-directories-toggle" data-gtmc="directories button" aria-label="Show Internal Directories"> Show internal </button> <button class="js-expandAllDirectories" data-test-id="directories-toggle" data-gtmc="directories button" aria-label="Expand All Directories"> Expand all </button> </div> </div> <table class="UnitDirectories-table UnitDirectories-table--tree js-expandableTable" data-test-id="UnitDirectories-table"> <tr class="UnitDirectories-tableHeader UnitDirectories-tableHeader--tree"> <th>Path</th> <th class="UnitDirectories-desktopSynopsis">Synopsis</th> </tr> <tr class=""> <td data-id="functions" data-aria-owns=""> <div class="UnitDirectories-pathCell"> <div><a href="/github.com/google/cel-go@v0.22.1/interpreter/functions">functions</a> </div> <div class="UnitDirectories-mobileSynopsis">Package functions defines the standard builtin functions supported by the interpreter and as declared within the checker#StandardDeclarations.</div> </div> </td> <td class="UnitDirectories-desktopSynopsis">Package functions defines the standard builtin functions supported by the interpreter and as declared within the checker#StandardDeclarations.</td></tr></tr> </table> </div> </div> </div> <div id="showInternal-description" hidden> Click to show internal directories. </div> <div id="hideInternal-description" hidden> Click to hide internal directories. </div> </article> <footer class="go-Main-footer"></footer> </main> <footer class="go-Footer"> <div class="go-Footer-links"> <div class="go-Footer-linkColumn"> <a href="https://go.dev/solutions" class="go-Footer-link go-Footer-link--primary" data-gtmc="footer link"> Why Go </a> <a href="https://go.dev/solutions#use-cases" class="go-Footer-link" data-gtmc="footer link"> Use Cases </a> <a href="https://go.dev/solutions#case-studies" class="go-Footer-link" data-gtmc="footer link"> Case Studies </a> </div> <div class="go-Footer-linkColumn"> <a href="https://learn.go.dev/" class="go-Footer-link go-Footer-link--primary" data-gtmc="footer link"> Get Started </a> <a href="https://play.golang.org" class="go-Footer-link" data-gtmc="footer link"> Playground </a> <a href="https://tour.golang.org" class="go-Footer-link" data-gtmc="footer link"> Tour </a> <a href="https://stackoverflow.com/questions/tagged/go?tab=Newest" class="go-Footer-link" data-gtmc="footer link"> Stack Overflow </a> <a href="https://go.dev/help" class="go-Footer-link" data-gtmc="footer link"> Help </a> </div> <div class="go-Footer-linkColumn"> <a href="https://pkg.go.dev" class="go-Footer-link go-Footer-link--primary" data-gtmc="footer link"> Packages </a> <a href="/std" class="go-Footer-link" data-gtmc="footer link"> Standard Library </a> <a href="/golang.org/x" class="go-Footer-link" data-gtmc="footer link"> Sub-repositories </a> <a href="https://pkg.go.dev/about" class="go-Footer-link" data-gtmc="footer link"> About Go Packages </a> </div> <div class="go-Footer-linkColumn"> <a href="https://go.dev/project" class="go-Footer-link go-Footer-link--primary" data-gtmc="footer link"> About </a> <a href="https://go.dev/dl/" class="go-Footer-link" data-gtmc="footer link">Download</a> <a href="https://go.dev/blog" class="go-Footer-link" data-gtmc="footer link">Blog</a> <a href="https://github.com/golang/go/issues" class="go-Footer-link" data-gtmc="footer link"> Issue Tracker </a> <a href="https://go.dev/doc/devel/release.html" class="go-Footer-link" data-gtmc="footer link"> Release Notes </a> <a href="https://blog.golang.org/go-brand" class="go-Footer-link" data-gtmc="footer link"> Brand Guidelines </a> <a href="https://go.dev/conduct" class="go-Footer-link" data-gtmc="footer link"> Code of Conduct </a> </div> <div class="go-Footer-linkColumn"> <a href="https://www.twitter.com/golang" class="go-Footer-link go-Footer-link--primary" data-gtmc="footer link"> Connect </a> <a href="https://www.twitter.com/golang" class="go-Footer-link" data-gtmc="footer link"> Twitter </a> <a href="https://github.com/golang" class="go-Footer-link" data-gtmc="footer link">GitHub</a> <a href="https://invite.slack.golangbridge.org/" class="go-Footer-link" data-gtmc="footer link"> Slack </a> <a href="https://reddit.com/r/golang" class="go-Footer-link" data-gtmc="footer link"> r/golang </a> <a href="https://www.meetup.com/pro/go" class="go-Footer-link" data-gtmc="footer link"> Meetup </a> <a href="https://golangweekly.com/" class="go-Footer-link" data-gtmc="footer link"> Golang Weekly </a> </div> </div> <div class="go-Footer-bottom"> <img class="go-Footer-gopher" width="1431" height="901" src="/static/shared/gopher/pilot-bust-1431x901.svg" alt="Gopher in flight goggles"> <ul class="go-Footer-listRow"> <li class="go-Footer-listItem"> <a href="https://go.dev/copyright" data-gtmc="footer link">Copyright</a> </li> <li class="go-Footer-listItem"> <a href="https://go.dev/tos" data-gtmc="footer link">Terms of Service</a> </li> <li class="go-Footer-listItem"> <a href="http://www.google.com/intl/en/policies/privacy/" data-gtmc="footer link" target="_blank" rel="noopener"> Privacy Policy </a> </li> <li class="go-Footer-listItem"> <a href="https://go.dev/s/pkgsite-feedback" target="_blank" rel="noopener" data-gtmc="footer link"> Report an Issue </a> </li> <li class="go-Footer-listItem"> <button class="go-Button go-Button--text go-Footer-toggleTheme js-toggleTheme" aria-label="Theme Toggle"> <img data-value="auto" class="go-Icon go-Icon--inverted" height="24" width="24" src="/static/shared/icon/brightness_6_gm_grey_24dp.svg" alt="System theme"> <img data-value="dark" class="go-Icon go-Icon--inverted" height="24" width="24" src="/static/shared/icon/brightness_2_gm_grey_24dp.svg" alt="Dark theme"> <img data-value="light" class="go-Icon go-Icon--inverted" height="24" width="24" src="/static/shared/icon/light_mode_gm_grey_24dp.svg" alt="Light theme"> <p> Theme Toggle </p> </button> </li> <li class="go-Footer-listItem"> <button class="go-Button go-Button--text go-Footer-keyboard js-openShortcuts" aria-label="Shorcuts Modal"> <img class="go-Icon go-Icon--inverted" height="24" width="24" src="/static/shared/icon/keyboard_grey_24dp.svg" alt=""> <p> Shortcuts Modal </p> </button> </li> </ul> <a class="go-Footer-googleLogo" href="https://google.com" target="_blank"rel="noopener" data-gtmc="footer link"> <img class="go-Footer-googleLogoImg" height="24" width="72" src="/static/shared/logo/google-white.svg" alt="Google logo"> </a> </div> </footer> <dialog id="jump-to-modal" class="JumpDialog go-Modal go-Modal--md js-modal"> <form method="dialog" data-gmtc="jump to form" aria-label="Jump to Identifier"> <div class="Dialog-title go-Modal-header"> <h2>Jump to</h2> <button class="go-Button go-Button--inline" type="button" data-modal-close data-gtmc="modal button" aria-label="Close" > <img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="" /> </button> </div> <div class="JumpDialog-filter"> <input class="JumpDialog-input go-Input" autocomplete="off" type="text"> </div> <div class="JumpDialog-body go-Modal-body"> <div class="JumpDialog-list"></div> </div> <div class="go-Modal-actions"> <button class="go-Button" data-test-id="close-dialog">Close</button> </div> </form> </dialog> <dialog class="ShortcutsDialog go-Modal go-Modal--sm js-modal"> <form method="dialog"> <div class="go-Modal-header"> <h2>Keyboard shortcuts</h2> <button class="go-Button go-Button--inline" type="button" data-modal-close data-gtmc="modal button" aria-label="Close" > <img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="" /> </button> </div> <div class="go-Modal-body"> <table> <tbody> <tr><td class="ShortcutsDialog-key"> <strong>?</strong></td><td> : This menu</td> </tr> <tr><td class="ShortcutsDialog-key"> <strong>/</strong></td><td> : Search site</td> </tr> <tr><td class="ShortcutsDialog-key"> <strong>f</strong> or <strong>F</strong></td><td> : Jump to</td> </tr> <tr> <td class="ShortcutsDialog-key"><strong>y</strong> or <strong>Y</strong></td> <td> : Canonical URL</td> </tr> </tbody> </table> </div> <div class="go-Modal-actions"> <button class="go-Button" data-test-id="close-dialog">Close</button> </div> </form> </dialog> <section class="Cookie-notice js-cookieNotice"> <div>go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic. <a target=_blank href="https://policies.google.com/technologies/cookies">Learn more.</a></div> <div><button class="go-Button">Okay</button></div> </section> <script> // this will throw if the querySelector can鈥檛 find the element const gtmId = document.querySelector('.js-gtmID').dataset.gtmid; if (!gtmId) { throw new Error('Google Tag Manager ID not found'); } loadScript(`https://www.googletagmanager.com/gtm.js?id=${gtmId}`); </script> <noscript> <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W8MVQXG" height="0" width="0" style="display:none;visibility:hidden"> </iframe> </noscript> <div class="js-canonicalURLPath" data-canonical-url-path="/github.com/google/cel-go@v0.22.1/interpreter" hidden></div> <div class="js-playgroundVars" data-modulepath="github.com/google/cel-go" data-version="v0.22.1" hidden></div> <script> loadScript('/static/frontend/unit/main/main.js') </script> <script> loadScript('/static/frontend/unit/unit.js') </script> </body> </html>