Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
11351: Allow sane conversions for `As*Map*` and `As*Array*` conversions r=iwahbe a=iwahbe Fixes #11348 Fixes #11347 This PR implements deep type conversion for the `As*Map` and `As*Array` methods on `AnyOutput`. For example, you can now call `AsIntArrayMapOutput` on an `AnyOutput` with underlying value `map[string]interface{}{"zero": []int{0}, "one": []int{1}}`. I choose to implement this with reflection (as opposed to in the templating system) because I didn't want to handle the combinatorial explosion of outer and inner types. This solution works for arbitrary nesting of arbitrary types. Co-authored-by: Ian Wahbe <ian@wahbe.com>
- Loading branch information
Showing
6 changed files
with
698 additions
and
406 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...pending/20221114--sdk-go--allow-sane-conversions-for-as-map-and-as-array-conversions.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changes: | ||
- type: feat | ||
scope: sdk/go | ||
description: Allow sane conversions for `As*Map*` and `As*Array*` conversions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.