databricks-cli/libs/dyn
Pieter Noordhuis 26094f01a0
Define `dyn.Mapping` to represent maps (#1301)
## Changes

Before this change maps were stored as a regular Go map with string
keys. This didn't let us capture metadata (location information) for map
keys.

To address this, this change replaces the use of the regular Go map with
a dedicated type for a dynamic map. This type stores the `dyn.Value` for
both the key and the value. It uses a map to still allow O(1) lookups
and redirects those into a slice.

## Tests

* All existing unit tests pass (some with minor modifications due to
interface change).
* Equality assertions with `assert.Equal` no longer worked because the
new `dyn.Mapping` persists the order in which keys are set and is
therefore susceptible to map ordering issues. To fix this, I added a
`dynassert` package that forwards all assertions to `testify/assert` but
intercepts equality for `dyn.Value` arguments.
2024-03-25 11:01:09 +00:00
..
convert Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
dynassert Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
dynvar Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
merge Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
yamlloader Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
yamlsaver Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
kind.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
kind_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
location.go Retain location annotation when expanding globs for pipeline libraries (#1274) 2024-03-11 21:59:36 +00:00
location_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
mapping.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
mapping_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
path.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
path_string.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
path_string_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
path_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
pattern.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
pattern_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
value.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
value_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
value_underlying.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
value_underlying_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
visit.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +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 Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
visit_map.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
visit_map_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
visit_set.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
visit_set_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
walk.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
walk_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00