google / cel-go

Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)
https://cel.dev
Apache License 2.0
2.31k stars 225 forks source link

feat: load map data on first access #950

Closed vivshankar closed 5 months ago

vivshankar commented 5 months ago

The change here is to introduce a version of DynamicMap to load map contents based on a loader function on first access only. This is to prevent the need to preload data, particularly from external sources, unless the type is actually used.

Given baseMap is internal, rather than clone the entire file, the change here is to introduce the MapValueLoader and an implementation is provided for DynamicMap and the corresponding reflectMapAccessor. This approach can be extended to the other map types too.

google-cla[bot] commented 5 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.