databricks-cli/libs/dyn
Pieter Noordhuis 2453cd49d9
Add `dyn.MapByPattern` to map a function to values with matching paths (#1266)
## Changes

The new `dyn.Pattern` type represents a path pattern that can match one
or more paths in a configuration tree. Every `dyn.Path` can be converted
to a `dyn.Pattern` that matches only a single path.

To accommodate this change, the visit function needed to be modified to
take a `dyn.Pattern` suffix. Every component in the pattern implements
an interface to work with the visit function. This function can recurse
on the visit function for one or more elements of the value being
visited. For patterns derived from a `dyn.Path`, it will work as it did
before and select the matching element. For the new pattern components
(e.g. `dyn.AnyKey` or `dyn.AnyIndex`), it recurses on all the elements
in the container.

## Tests

Unit tests. Confirmed full coverage for the new code.
2024-03-08 14:33:01 +00:00
..
convert Handle alias types for map keys in toTyped conversion (#1232) 2024-02-22 15:17:43 +00:00
dynvar Allow use of variables references in primitive non-string fields (#1219) 2024-02-19 10:44:51 +00:00
merge Include `dyn.Path` as argument to the visit callback function (#1260) 2024-03-07 13:56:50 +00:00
yamlloader Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
yamlsaver Generate correct YAML if custom_tags or spark_conf is used for pipeline or job cluster configuration (#1210) 2024-02-15 15:03:19 +00:00
kind.go Define constant for the invalid `dyn.Value` (#1101) 2024-01-05 13:02:04 +00:00
kind_test.go Define constant for the invalid `dyn.Value` (#1101) 2024-01-05 13:02:04 +00:00
location.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
location_test.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
path.go Use `dyn.Value` as input to generating Terraform JSON (#1218) 2024-02-16 20:54:38 +00:00
path_string.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
path_string_test.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
path_test.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
pattern.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
pattern_test.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
value.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
value_test.go Define constant for the invalid `dyn.Value` (#1101) 2024-01-05 13:02:04 +00:00
value_underlying.go Consolidate functions to convert `dyn.Value` to native types (#1100) 2024-01-05 12:06:12 +00:00
value_underlying_test.go Consolidate functions to convert `dyn.Value` to native types (#1100) 2024-01-05 12:06:12 +00:00
visit.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
visit_get.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
visit_get_test.go Add functionality to visit values in `dyn.Value` tree (#1142) 2024-01-24 18:38:46 +00:00
visit_map.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
visit_map_test.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
visit_set.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
visit_set_test.go Add functionality to visit values in `dyn.Value` tree (#1142) 2024-01-24 18:38:46 +00:00
walk.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
walk_test.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00